我想以这样的方式配置我的 nginx 配置,即非 https 升级到 https,然后代理传递应该转到 https://ip:8443/SOMECONTEXT/
我怎样才能实现它
这是我正在使用的配置
server {
listen ip:80;
server_name subdomain1.example.com subdomain2.example.com;
access_log /var/log/nginx/subdomain1.example.com_access.log;
error_log /var/log/nginx/subdomain1.example.com_error.log warn;
location /.well-known/acme-challenge {
default_type "text/plain";
root /var/www/html;
}
location / {
return 301 https://$host/$request_uri;
}
}
server {
listen ip:443;
server_name subdomain1.example.com subdomain2.example.com;
access_log /var/log/nginx/subdomain1.example.com_access.log;
error_log /var/log/nginx/subdomain1.example.com_error.log warn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://ip:8443/;
proxy_connect_timeout 6000;
proxy_send_timeout 6000;
proxy_read_timeout 6000;
send_timeout 6000;
}
}