我正在尝试使用NGinx创建反向代理。
这是我的配置:
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name reverseproxy;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location /intranet {
return 302 /intranet/;
}
location /intranet/ {
proxy_set_header Host intranet.example.com;
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://intranet.example.com/;
proxy_read_timeout 90;
}
}
我们也通过IP地址访问服务器,而不是按名称访问服务器,所以当我尝试访问Intranet时,我会收到Bad Gateway 502.
Intranet托管在另一个服务器中,在另一个网络中。
由于