nginx反向代理 强制https请求

 

upstream emove_pools { 
    server 10.1.27.198:8020;
    check interval=3000 rise=2 fall=3 timeout=2000;
 }
#强制使用https跳转
server { 
        listen 80;
        server_name test.ok.com;
        return 301    https://$server_name$request_uri;
        location / { 
            proxy_pass http://name_pools;
 }

 }
#
server { 
    #listen 80;
    listen 443;
    server_name test.ok.com;
    access_log /data1/logs/nginx/test.ok.com/access.log;
    ssl on;
    ssl_certificate /etc/cert/xxxxx023.pem;
    ssl_certificate_key /etc/cert/xxxxx023.key;
    ssl_session_cache shared:SSL:1m;
    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;
    location / { 
        proxy_pass http://name_pools;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }
 }

 

posted @ 2017-09-28 15:38  bass  阅读(1608)  评论(0编辑  收藏  举报