我想在启用ssl的情况下进行基于自定义位置的反向代理:
https://server.ravi.local/test ---> server1.ravi.local:443 / server2.ravi.local:443
我无法这样做。这是代码:
upstream myapp1 {
server server1.ravi.local:443;
server server2.ravi.local:443;
}
server {
server_name server.ravi.local;
listen 8010 ssl;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl on;
location /test {
rewrite /test/(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://myapp1;
}
}