我在端口8929上有服务,然后像这样设置反向代理
server {
server_name xxxx.com;
location / {
proxy_pass http://xxxx.com:8929;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/xxxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxxx.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 = xxxx.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name xxxx.com;
return 404; # managed by Certbot
location / {
proxy_redirect https://$host:8929$request_uri https://$host$request_uri;
}
}
昨天,当我不使用certbot时,一切都正常进行,当我使用xxxx.com:8929访问url时,它可以正常运行,但是当我使用certbot并且访问xxxx.com:8929时已经安装了SSL时,就会收到错误消息像下面的
此网站无法提供安全的连接xxxx.com发送了无效的回复。 ERR_SSL_PROTOCOL_ERROR
我想怎么做,以便当用户访问https://xxxx.com:8929时他将重定向到https:// $ host $ request_uri?
这有可能吗?