nginx 實用案例
阿新 • • 發佈:2018-01-15
-i -a sha pro header cer timeout urn 1.2 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 實用案例