> CentOS > CentOS故障 >

CentOS服务器下Nginx未启动的解决方法

问题一:


0.nginx: [emerg] host not found in upstream “11.lum” in /usr/local/nginx/conf/vhost.conf:116
1.Nginx 启动成功! Nginx was started successfully.
上面错误为nginx未启动,点启动时提示上面语句。
类似这告诉的错误,解决方案

点左侧 网站(虚拟主机) => 编辑 任何一个网站 => 不用改什么 直接保存 => 在去启动nginx 启动成功后 在去编辑任何一个网站,不用改什么直接保存 => ok

问题二:如果重启服务器后,Nginx为启动,在后台手动启动Nginx报下面的错误

0.Shutting down php_fpm Starting php_fpm done nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 128 nginx: [emerg] could not build the server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 128
1.Nginx重启失败! Nginx was restarted failed.
解决方法,登录ssh,把/usr/local/nginx/conf/nginx.conf 文件里这一行的数值修改下

原来的是:
server_names_hash_bucket_size 128;
改成:
server_names_hash_bucket_size 512;


如果自己手工修改过网站伪静态的,这块也检查下,有的时候也可能是网站伪静态的问题,删除之前的伪静态在启动,也可以解决问题。


(责任编辑:IT)