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

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

我需要帮助,我不知道出了什么问题。

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

server {

    root /var/www/example.com/public;

    index index.html index.php index htm;

    server_name www.example.com example.com;

    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {

    if ($host = www.example.com) {
        return 301 https://www.$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://www.$host$request_uri;
    } # managed by Certbot

    return 404; # managed by Certbot
}

相关内容