网站制作学习网Linux→正文:nginx proxy代理https
字体:

nginx proxy代理https

Linux 2015/6/24 15:56:27  点击:不统计

<本文原载于www.forasp.cn>
 nginx proxy代理https,我们在做nginx proxy代理的时候,需要将https 也进行代理,在查询网上文章中有人说是不支持的,后来查询到,这个https加密的可以直接将https传递过去,即在当前本机不接写,直接扔到后台。配置如下

server {
listen       443 ssl;
#ssl on;
ssl_certificate /forasp.crt;
ssl_certificate_key /forasp.key;
server_name *.forasp.com;
server_name forasp.com;
charset UTF-8;
index index.html index.htm index.php;
root  /data/ptop;
location / {
proxy_pass http://ptop_cdn; //这里指向了后台upstream的服务器地址
proxy_set_header   Host    $host;//传递域名
proxy_set_header   X-Real-IP   $remote_addr;//传递ip
proxy_set_header REMOTE-HOST $remote_addr;//
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;//
proxy_set_header X-Forwarded-Proto https; //将协议传递过去为https
}
}
这样配置后可以直接将https 传递到后端upstream,后端的服务器可以直接操作并返回。

%77w%77%2E%66%6F%72%61%73%70%2E%63%6E

·上一篇:sar工具命令小结 >>    ·下一篇:apache traffic server(TS) 多个二级域名 >>
推荐文章
最新文章