nginx https 反向代理 跳转

1. nginx直接跳转转发

server {
    listen       443 ssl;
    server_name  erjiyuming.cheerlose.com;

   ssl_certificate      /etc/nginx/ssl/erjiyuming.cheerlose.com/server.pem;
   ssl_certificate_key  /etc/nginx/ssl/erjiyuming.cheerlose.com/server.key;

    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_protocols  TLSv1.2 SSLv3;
    ssl_prefer_server_ciphers on;
    access_log  logs/idedsr.access.log  main;
    error_log   logs/idedsr.error.log;


    location / {
                 proxy_redirect off;
                 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_connect_timeout 600s;
                 proxy_read_timeout 600s;
                 proxy_send_timeout 600s;
                 proxy_pass http://192.168.40.163:8001;

     }
}

/etc/nginx/conf/conf.d/dsr.conf

用域名来区分转发规则

https://web.a.com/  --> 192.168.40.163:7000

https://message.a.com/  --> 192.168.40.163:7001

https://ide.a.com/  --> 192.168.40.163:8001

用一个例子来演示会更加清晰
原文地址:https://www.cnblogs.com/hixiaowei/p/15069302.html