nginx: [警告] 0.0.0.0:80 上的冲突服务器名称“example.com”,被忽略

gji*_*nya 6 python deployment django nginx

当我尝试重新启动 nginx 时,出现以下错误

nginx: [warn] conflicting server name "example.io" on 0.0.0.0:80, ignored
Run Code Online (Sandbox Code Playgroud)

我使用我的部署脚本来为 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;
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 1

不确定,但尝试更改服务器名称

/etc/nginx/sites-enabled/default

它应该有帮助