文件格式为server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } error_page 404 /404.html; location = /40x.html { }...
listen [::]:80 default_server; server_name _; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root /usr/share/nginx/html/download; autoindex on; #开启索引功能 autoindex_exact_size off; #关闭计算文件确切大小(单位bytes),只显示大概...
# ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /40x.html { # } # # error_page 500 502 503 504 /50x.html; # location =...
# Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { #return 200 'a'; #root /usr/share/nginx/html; #index index.html index.htm; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; ...
确定如何处理请求。这包括选择正确的服务器块(server block)和位置块(location block)。
ssl_prefer_server_ciphers on; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { proxy_pass http://mobile_pool; } } 可以看到location中proxy_pass 对应于上面那个负载均衡,你如果不想搞负载均衡,在这里写死就完了,只有一台机器,也没啥负载...
ssl_prefer_server_cipherson; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; ...
server_name onedayxyy.cn;# #root /usr/share/nginx/html;# root /root/rsync/public;## # Load configuration files for the default server block.# include /etc/nginx/default.d/*.conf;## error_page 404 /404.html;# location = /404.html {# }## error_page 500 502 503 504 /50x.html;...
conf.d/目录下存放server块的配置文件,default.d/目录下存放location块的配置文件,引用的时候使用include指令将相对应的server块配置文件和location配置文件加入各自的block块中即可。 http { ...<http全局指令>... include /etc/nginx/conf.d/*.conf; } 或者 server { ...<server全局指令>... include /etc...