nginx 反向代理网关无法与 SSL 配合使用

nginx 反向代理网关无法与 SSL 配合使用

Web 服务器目标服务器上的端口 80192.168.0.43在所有方面均能正常工作:网关和局域网内部。完美。

我在网关上192.168.0.60完美生成了certbot 证书

该域指向网关的对外 IP,即192.168.0.60具有对外 IP,并在端口 80 和端口 443 上侦听域 madeupexample.com

这是网关 nginx conf192.168.0.60

server{
# SSL configuration
#
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;

        server_name madeupexample.com www.madeupexample.com;

        ssl_certificate /etc/letsencrypt/live/www.madeupexample.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/www.madeupexample.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

        ssl_session_cache shared:SSL:1m;

        location / {
                proxy_pass http://192.168.0.43;
                proxy_set_header Host $host;
        }


        error_page 404 /404.html;
                location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
                location = /50x.html {
        }
}

server {
   listen 80;

   server_name madeupexample.com www.madeupexample.com;

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

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

   return 404; # managed by Certbot
}

这曾经很好用

server {
    listen 80;
    server_name madeupexample.com www.madeupexample.com;

    location / {
         proxy_pass http://192.168.0.43;
    }
}

我做错了什么?域名只是旋转

相关内容