使用 nginx 反向代理 http 的网站没有问题,但是去反向代理 https 的网站老是有问题,如:源站: https://www.abc.com ,然后用 https://www.123.com 去反向代理源站就会出问题,能不能给出一份 nginx 反代 https 的配置文件?
1
qgy18 2016-01-27 14:49:18 +08:00
Nginx 不支持正向代理 HTTPS ,因为它不支持 CONNECT ,反代 HTTPS 没有任何问题啊。
proxy_pass 那里改成源站 HTTPS 地址即可,你是怎么配的? |
2
lhbc 2016-01-27 14:49:35 +08:00
站内搜索 nginx 反代 google
|
3
Had 2016-01-27 14:51:19 +08:00
升级 Nginx 1.8 + 试试?
|
4
shuson 2016-01-27 14:53:55 +08:00
这俩参数好好结合官方文档检查
proxy_pass and proxy_redirect |
5
liuweisj 2016-01-27 15:30:20 +08:00
```
server{ listen 443; server_name api.weixin.qq.com; access_log logs/weixin.qq.access.log; error_log logs/weixin.qq.error.log; ssl on; ssl_certificate /usr/local/nginx/conf/server.crt; ssl_certificate_key /usr/local/nginx/conf/server.nopass.key; location / { index index.html; proxy_pass https://api.weixin.qq.com; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Forwarded-proto https; } } ``` |
6
dofy 2016-01-27 15:59:25 +08:00
server {
listen 80; listen 443 ssl; server_name api.seven.org; access_log off; ssl_certificate /Users/Seven/works/cert/ssl-bundle.crt; ssl_certificate_key /Users/Seven/works/cert/private.key; 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; if ($scheme ~* "http") { proxy_pass http://localhost:11080; } if ($scheme ~* "https") { proxy_pass http://localhost:11443; } proxy_redirect off; } } |