1
当我试图重启nginx的,我发现了以下错误nginx的:[警告]上0.0.0.0:80冲突的服务器名“example.com”,忽略
nginx: [warn] conflicting server name "example.io" on 0.0.0.0:80, ignored
我用我的部署脚本,为2个域进行部署。首先它工作正常,但第二,它会给出错误。
这里是我的nginx.conf文件
#
worker_processes 2;
#
user nginx nginx;
#
pid /opt/nginx/pids/nginx.pid;
error_log /opt/nginx/logs/error.log;
#
events {
worker_connections 4096;
}
#
http {
#
log_format full_log '$remote_addr - $remote_user $request_time $upstream_response_time '
'[$time_local] "$request" $status $body_bytes_sent $request_body "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#
access_log /opt/nginx/logs/access.log;
ssl on;
ssl_certificate /opt/nginx/cert/example.crt;
ssl_certificate_key /opt/nginx/cert/example.key;
#
include /opt/nginx/conf/vhosts/*.conf;
# Deny access to any other host
server {
server_name example.io; #default
return 444;
}
}
任何人可以帮助我解决这个问题?
谢谢!
开始在文件称为'nginx.conf'启用站点和看看'server'块和'include'语句。您可能正在读取备份文件,这意味着'nginx'在端口80上看到了相同的'server_name'两次。 –
@RichardSmith我编辑我的问题,并添加nginx.conf文件 – gjivanya
@RichardSmith你是对的。问题来自server_name块中的一个子域conf文件并包含语句。 – gjivanya