erver
{
listen 80;
server_name www.tt.com;
location / {
proxy_pass http://week;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (!-f $request_filename) {
proxy_pass http://127.0.0.1:8888;
}
}
17.0.0.1:8888配置如下
erver
{
listen 8888;
server_name www.tt.com;
location / {
root /root;
index index.html;
error_page 500 502 404 /404.html;
}
}
需要维护的时候,只需要重启Nginx服务。
kill -HUP 'cat logs/nginx.pid'
方法二:单独创建一个testnginx.conf文件
#user nobody;
worker_processes 1;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 50000;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server
{
listen 80;
server_name www.tt.com;
location / {
root /root;
index index.html;
error_page 500 502 404 /404.html;
}
}
}
维护时只需把Nginx 502错误停止,从新启用新的配置文件
killall -9 nginx
nginx -c ../conf/testnginx.conf
以上就是对Nginx 502错误的详细介绍希望大家有所帮助。
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。