加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

nginx: [warn] conflicting server name "" on

发布时间:2020-12-13 20:51:24 所属栏目:Nginx 来源:网络整理
导读:《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 s

《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  52php.cn;

#    return       301 http://www.52php.cn$request_uri;

}


只要全部注释掉就好

#server {
#    listen       80;
#    server_name  52php.cn;
#    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.52php.cn" on 0.0.0.0:80,ignored


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

修正即可。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读