nginx-反向代理https

2020-04-13

基于centos7 配置nginx https反向代理百度(可以根据需要改成公司内部业务系统url)

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
server{
listen 443 ssl;
server_name www.qcloudv.com;
access_log /var/log/nginx/proxy.qcloudv.access.log;
error_log /var/log/nginx/proxy.qcloudv.error.log;
ssl_certificate /etc/nginx/ssl/qcloudv.crt;
ssl_certificate_key /etc/nginx/ssl/qcloudv.key;
location / {
proxy_pass https://www.baidu.com/;
proxy_redirect off;
proxy_set_header Host www.baidu.com;
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;
}
}
1
nginx -t
1
nginx -s reload

访问https://www.qcloudv.xyz 就会是访问百度的效果。