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


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

修正即可。

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...