这些server都必须和默认的那个server平级,另外,proxy_pass 是在server中配置的。
windows:
这里的admin是nginx根目录下和html平级的目录
server { listen 8000; server_name localhost; root admin; index index.html; }
linux:
这里的配置是centos的nginx环境下
server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/website; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root website; index index.html; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }