我有一个奇怪的问题,其中第一个反向代理网站工作正常,但如果即时通讯尝试添加第二个site-enabled
几乎相同的设置只有几个重大更改像server_name
nginx不会启动或重新加载。如果我删除新的site-enabled
它工作正常。Seccond nginx网站不工作
这里工作站点代码:
include /etc/nginx/conf.d/shop_header;
server {
listen 80;
server_name www.classybrothers.com classybrothers.com;
include /etc/nginx/conf.d/shop_etc;
}
shop_header:
server_names_hash_bucket_size 64;
upstream shop {
server 127.0.0.1:2500;
}
server {
listen 80;
return 404;
}
shop_etc:
access_log /home/web/shop/logs/access.log;
error_log /home/web/shop/logs/error.log;
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://shop/;
proxy_redirect off;
}
它工作正常。但是,如果我想添加我的第二个网站与子域和不同的端口nginx不会启动。这里是seccond网站的代码:
include /etc/nginx/conf.d/ttt_header;
server {
listen 80;
server_name www.ttt.classybrothers.com ttt.classybrothers.com;
include /etc/nginx/conf.d/ttt_etc;
}
头:
server_names_hash_bucket_size 64;
upstream ttt {
server 127.0.0.1:3000;
}
server {
listen 80;
return 404;
}
等:
access_log /home/web/ttt/logs/access.log;
error_log /home/web/ttt/logs/error.log;
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://ttt/;
proxy_redirect off;
}
我现在不能弄清楚这个问题了一会儿。如果有人遇到这个问题,建议我可以做些什么来解决这个问题,那将会很棒。
编辑:问题解决了,它是server_names_hash_bucket_size 64;
删除它解决了问题。我的猜测是,如果一个网站已经运行,其他人不需要重复。
我的nginx没有生成任何消息,只是简单地响应reaload命令。谢谢你的回答。 – Ramirex 2014-11-09 18:59:41
只要给nservice文件一个'reload'命令,就可以向主进程发送一个SIGHUP信号。检查该服务是否使用了正确的pid文件或手动发出信号并查看日志。 – 2014-11-09 21:23:04