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