ここで働くかもしれない設定があります。マスタを介してプロキシし、Server3にすべて転送します。 sslポートを使用しますが、sslはオフにします。
server {
listen 443;
server_name myserver.mydomain.whatever;
ssl off;
access_log /var/log/nginx/myserver.access.log;
error_log /var/log/nginx/myserver.error.og;
keepalive_timeout 60;
location/{
set $fixed_destination $http_destination;
if ($http_destination ~* ^https(.*)$)
{
set $fixed_destination http$1;
}
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_set_header Destination $fixed_destination;
# Fix the “It appears that your reverse proxy set up is broken" error.
# might need to explicity set https://localip:port
proxy_pass $fixed_destination;
# force timeout if backend died.
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_read_timeout 90;
proxy_redirect http:// https://;
}
}
ありがとうございました。私はすべてが正しければあまりよく分かりません。 「listen 80;」のサーバー定義で何をすべきですか?それをマスターnginxサーバー上の443にリダイレクトして、コード例を使用しますか?あなたの例では、リクエストが内部的にどのIPに転送されるのかを指定しますか? –
私は両方の方法でそれをテストしました。 "2015/10/22 11:34:21 [error] 18229#0:* 57916" "、クライアント:xxx.xxx.xxx.xxx、サーバー:my_server_nameに無効なURL接頭辞があります。 "GET/HTTP/1.1 $'またはブラウザで直接接続が確立されず、接続が拒否されたというメッセージが表示される –
Nginxはフォワードプロキシを使用していないようです[フォワードプロキシとしてhttpsとnginx] (https://forum.nginx.org/read.php?2,15124,15256#msg-15256)。 – wolfhammer