Nginx上游https ssl

时间:2017-09-20 15:22:51

标签: ssl nginx https proxy

我试图将nginx配置为https网站的反向代理(无缓存)我已按照所有说明和有关此配置的所有提示而且我无法工作。 我附上了我的文件代码:

上游:

upstream myhttpssite{
server (ip):443;

}

重定向的代码:

 server {
 listen (localip):443 ssl;
 #redirect to https protocol if http is requested
 return 301 https://$server_name$request_uri; 
 server_name (localip);
 ssl on;
 root /var/www;
 index index.html index.htm;

ssl_certificate /etc/nginx/certs/3/server.crt;
ssl_certificate_key /etc/nginx/certs/3/server.key;
ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
keepalive_timeout    60;
ssl_session_cache    shared:SSL:10m;
ssl_verify_client off;
proxy_ssl_session_reuse on;
ssl_session_timeout  10m;
large_client_header_buffers 4 32K;

access_log  ...
 error_log   ...


location / {
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_cache off;
proxy_pass https://myhttpssite;

}  }

我进入请求502 BAD网关,如果我更改了http://myhttpssite的proxy_pass,并且在上游我删除了:443我被重定向到http网站而没有来自https://请求的问题。

你能告诉我这里出了什么问题吗?

提前致谢。

0 个答案:

没有答案