码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 实用案例

时间:2018-01-15 11:20:00      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:https   cat   rc4   127.0.0.1   com   man   nexus   rpc   server   

Nginx SSL Proxy:
upstream nexus {
    server 127.0.0.1:8081 weight=1 max_fails=2 fail_timeout=30s;
}   
server {
    listen 443 ssl;
    server_name nexus.******.com;
    #ssl on;
    ssl_certificate ssl/1_nexus.******.com_bundle.crt;
    ssl_certificate_key ssl/2_nexus.******.com.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
    ssl_prefer_server_ciphers on;
    location / {
             proxy_pass http://nexus;
             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   https;
             client_max_body_size 300M;
    }
}
server {
        listen 80;
        server_name nexus.******.com;
        rewrite ^(.*)$  https://$host$1 permanent;
}

Nginx grpc Proxy:

server {
        listen 8080;
        server_name nexus.umarkcloud.com;

         if ( $request_uri = / ) {
            return 301 http://$host:8080/grpc-precompiled-binaries/node/grpc/;
         }

        location  ~ /grpc-precompiled-binaries/node/grpc/(.*$) {
                proxy_pass  https://npm.taobao.org/mirrors/grpc/$1;
                proxy_redirect          off;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location ~ /mirrors/grpc/.*$ {
                proxy_pass https://npm.taobao.org;
        }
}

nginx 实用案例

标签:https   cat   rc4   127.0.0.1   com   man   nexus   rpc   server   

原文地址:http://blog.51cto.com/noican/2060988

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!