Nginx 反向代理及https配置

参考代码

在server中添加

        location /api {
            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_pass http://IP:9000/web
        }

 

https

    server {
        listen 443;
        server_name xxx.com;
        ssl on;
        ssl_certificate  1_www.xxx.com_bundle.crt;
        ssl_certificate_key 2_www.xxx.com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /api {
            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_pass http://IP:9000/web;
        }
    }

你可能感兴趣的:(Nginx 反向代理及https配置)