我使用Nginx的反向代理,我想强制请求进入HTTPS,因此如果用户想要使用http访问该URL,他将自动重定向到HTTPS.
我也使用非标准端口.
这是我的nginx反向代理配置:
server {
listen 8001 ssl;
ssl_certificate /home/xxx/server.crt;
ssl_certificate_key /home/xxx/server.key;
location / {
proxy_pass https://localhost:8000;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
}
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试了很多东西并且还阅读了有关它的帖子,包括这个服务器故障问题,但到目前为止还没有任何工作.