nginx http转发至多https接口

user  root;
worker_processes  10;

worker_rlimit_nofile 65535;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
       listen 6663;
       server_name 17.120.4.6;
       location /cmd1/ {
           proxy_pass_header Server;
           proxy_set_header   Host $http_host;
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   X-Scheme $Scheme;
           proxy_ssl_certificate /usr/local/nginx/ssl/client.crt;
           proxy_ssl_certificate_key /usr/local/nginx/ssl/client.key;
           proxy_pass https://17.120.2.1:6663/;
       }
    }
    server {
       listen 6630;
       server_name 17.120.4.6;
       location /cmd2/ {
           proxy_pass_header Server;
           proxy_set_header   Host   $http_host;
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   X-Scheme $Scheme;
           proxy_ssl_certificate /usr/local/nginx/ssl/client.crt;
           proxy_ssl_certificate_key /usr/local/nginx/ssl/client.key;
           proxy_pass https://17.120.3.1:6630/;
       }
    }
    server {
       listen 6443;
       server_name 17.120.4.6;
       location /cmd3/ {
           proxy_pass_header Server;
           proxy_set_header   Host   $http_host;
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   X-Scheme $Scheme;
           proxy_ssl_certificate /usr/local/nginx/ssl/certificate/client.crt;
           proxy_ssl_certificate_key /usr/local/nginx/ssl/certificate/client.key;
           proxy_pass https://1.0.1.10:6443/;
       }
       location /zoro/ {
           proxy_pass_header Server;
           proxy_set_header   Host   $http_host;
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   X-Scheme $Scheme;
           proxy_ssl_certificate /usr/local/nginx/ssl/certificate/client.crt;
           proxy_ssl_certificate_key /usr/local/nginx/ssl/certificate/client.key;
           proxy_pass https://1.0.1.10:6443/;
       }
    }
}

 

posted @ 2021-11-30 23:17  明天OoO你好  阅读(359)  评论(0编辑  收藏  举报