【发布时间】:2018-12-05 05:22:25
【问题描述】:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server{
server_name sample.com;
listen 80;
location = / {
root /root_path;
index index.html;
}
location / {
# root /root_path;
# index index.html;
# proxy_pass http://127.0.0.1:5200;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $host; # pass the host header - http://wiki.nginx.org/HttpProxyModule#proxy_pass
# proxy_http_version 1.1; # recommended with keepalive connections - http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
# WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
}
}
这只是“/etc/nginx/site-enable”中的配置文件,但仍然是它的加载nginx默认页面。这怎么可能?如果默认 root 没有在 server 块中定义,而只是在 location 块中,root 是否默认为 nginx 默认根目录?
【问题讨论】:
-
您在浏览器中使用
sample.com吗?include /etc/nginx/site-enable/*.conf;是否存在于nginx.conf -
是的,但配置文件中没有任何包含。
-
Nginx 使用
nginx.conf读取配置。如果没有includeNginx 无法读取你的配置文件 -
" 包含 /etc/nginx/conf.d/*.conf; 包含 /etc/nginx/sites-enabled/*; " 抱歉,"nginx.conf" 中有包含
标签: nginx nginx-config