【发布时间】:2017-04-06 21:14:31
【问题描述】:
我有两个 nginx 服务器 A 和 B。B 有一个服务器块,例如 example.com,其中包括 http 到 https 重定向。现在我希望 A 将 example.com 的流量直接引导到 B。我尝试了以下操作
在 A 中:
upstream ipOfB {
server 12.34.56.78;
}
server {
listen 80;
listen 443;
server_name example.com;
location / {
proxy_set_header Host $host;
proxy_pass http://ipOfB;
}
}`
在 B 中:
upstream docker {
server 0.0.0.0:8080;
}
server {
listen 80;
server_name example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name example.com
location / {
...
}
}
我在尝试 example.com 时收到了太多重定向。
【问题讨论】:
-
您找到解决方案了吗?我有同样的问题。
标签: nginx nginx-location