nginx: [warn] conflicting server name on 0.0.0.0:80, ignored

《nginx: [warn] conflicting server name "" on 0.0.0.0:80,ignored》要点:
本文介绍了nginx: [warn] conflicting server name "" on 0.0.0.0:80,ignored,希望对您有用。如果有疑问,可以联系我们。

在启动Nginx时,出现如下错误:

nginx: [warn] conflicting server name "" on 0.0.0.0:80,ignored

检查:

[root@iZuf67db nginx]# nginx -t
nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored

这个是因为在配置文件中,有空的server{},如下:

server {

#    listen       80;

#    server_name  jb51.cc;

#    return       301 http://www.jb51.cc$request_uri;

}

只要全部注释掉就好

#server {
#    listen       80;
#    server_name  jb51.cc;
#    return       301  
#}

再检查就不会出错:

[root@iZuf67db vhost]# nginx -t

the configuration file /nginx/conf/nginx.conf syntax is ok

configuration file /nginx/conf/nginx.conf test is successful

注意:

如果你的错误提示中出现了域名,比如:

nginx: [warn] conflicting server name "www.jb51.cc" on 0.0.0.0:80,ignored


那可能是你的一个域名绑定了多个站点。同一个域名解析到了不同的目录。一般将配置文件单独分离出来容易出现这个错误。

修正即可。

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。