为什么 nginx 安装后,没有修改任何配置文件,只在/var/www/html 下新建一个文件夹和一个 html 文件,就能通过 “http://ip/文件夹” 访问了

2021-05-11 08:56:22 +08:00
 zxCoder

我记得以前不还得配置 server location 什么的

配置文件我看 /etc/nginx/nginx.conf 里基本都注释了,include 的文件夹也都是空的,不知道默认配置在哪里

然后 /usr/share/nginx/html 也有一个 index.html,这个不知道是干嘛的

求一个 nginx 最新的配置文档,官网文档挺乱的

2213 次点击
所在节点    NGINX
11 条回复
Lax
2021-05-11 09:10:00 +08:00
nginx -V 看看编译选项
wclebb
2021-05-11 09:12:16 +08:00
为什么 iPhone 插了手机卡后,没有填写任何填表文件,只要在 通话 App 下拨号 13412341234 就能通过通话拨号了呢?
yanyumihuang
2021-05-11 09:14:07 +08:00
默认绑定了 80 端口,在就在 /etc/nginx/下的文件夹里,你好好找找,我记不清是哪个了
zxCoder
2021-05-11 09:14:31 +08:00
@Lax

nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 1.1.1f 31 Mar 2020
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-5J5hor/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-compat --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module


没找着 /var/www
zxCoder
2021-05-11 09:15:27 +08:00
@yanyumihuang

配置文件 nginx.conf 是这样的

user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
drush
2021-05-11 09:16:19 +08:00
/etc/nginx/sites-available/default
titanium98118
2021-05-11 09:16:59 +08:00
不同发行版本,打包都不一样,ubuntu 里的 nginx.conf 默认有 include 的
lizenghui
2021-05-11 09:17:07 +08:00
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;


这不是还有配置嘛,都是空的?
wangsipeng95
2021-05-11 09:18:15 +08:00
默认 nginx.conf 里面应该有 include /etc/nginx/conf.d/*.conf; 我记得 /etc/nginx/conf.d 里面有个 default.conf
zxCoder
2021-05-11 09:26:33 +08:00
@drush
@titanium98118
@lizenghui
@wangsipeng95

是在这个下面找到了 /etc/nginx/sites-enabled/*

多谢各位
hades97
2021-05-11 14:30:47 +08:00
/etc/nginx/sites-available 这里列出你的全部网站
/etc/nginx/sites-enabled 这里是启用你的网站,实际是建立一个 link 到 available 里面的文件

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/776140

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX