安装Certbot SSL证书后出现404错误

时间:2019-04-30 14:02:01

标签: ssl nginx https certbot

我的网站通常正常运行,但是有时会出现404错误,例如,单击Android Messages应用程序中的链接时。这是我启用了站点的目录中的配置文件:

server {
    server_name www.trademurx.com;

    location /static {
        alias /root/static;
    }

    location / {
        proxy_pass http://localhost:8000;
        include /etc/nginx/proxy_params;
        proxy_redirect off;
    }

    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/www.trademurx.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.trademurx.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
    if ($host = (www.trademurx.com)) {
        return 301 https://$host$request_uri;
    }

    if ($host = trademurx.com) {
        return 301 https://$host$request_uri;
    }


    listen 80;
    server_name www.trademurx.com;
    return 404;
}

0 个答案:

没有答案