服务器问答

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

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

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

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

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


nginx -V 看看编译选项

为什么 iPhone 插了手机卡后,没有填写任何填表文件,只要在 通话 App 下拨号 13412341234 就能通过通话拨号了呢?

默认绑定了 80 端口,在就在 /etc/nginx/下的文件夹里,你好好找找,我记不清是哪个了


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


配置文件 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/*;
}

{
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;
}
#}

/etc/nginx/sites-available/default

不同发行版本,打包都不一样,ubuntu 里的 nginx.conf 默认有 include 的

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

这不是还有配置嘛,都是空的?

默认 nginx.conf 里面应该有 include /etc/nginx/conf.d/*.conf; 我记得 /etc/nginx/conf.d 里面有个 default.conf





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

/etc/nginx/sites-available 这里列出你的全部网站
/etc/nginx/sites-enabled 这里是启用你的网站,实际是建立一个 link 到 available 里面的文件

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服