nginx -t报错:nginx: [warn] conflicting server name “localhost“ on 0.0.0.0:80, ignored

报错原因: 在多个配置文件中使用server_name localhost 或者在一个配置文件的server中使用多次server_name localhost

解决方法: 删除多余的server_name localhost,或修改其他配置文件的后缀,不是.conf基本都可以。
可以使用以下命令检查:
grep -r localhost /usr/local/nginx/
找出这个目录下所有包含localhost的文件及所在行。

猜你喜欢

转载自blog.csdn.net/weixin_36522099/article/details/108265349