kbengine of nginx reverse proxy https / wss load balancing configuration support kbe

 

Micro-channel development requirements must connect with https and wss, here is nginx reverse proxy configuration, own use all normal, hoping to help you. Domain name must be in the development of micro letter backstage set, or not connected, the domain name to the record, or do not pass the audit.
nginx.conf add two lines


wss.conf follows

  1. upstream login_websocket {
  2.     server 120.*.*.*:20013 weight=1;
  3.         server 120.*.*.*:20014 weight=1;
  4.         server 120.*.*.*:20012 weight=1;
  5. }
  6. upstream baseapp_websocket0 {
  7.     server 120.*.*.*:20015;
  8. }
  9. upstream baseapp_websocket1 {
  10.     server 120.*.*.*:20016;
  11. }
  12. upstream baseapp_websocket2 {
  13.     server 120.*.*.*:20017;
  14. }
  15. upstream web {
  16.     .. Server www ** cn: 8081; # port set up their own domain name
  17. }
  18. server {
  19.     listen 443;
  20.     #server_name www.goworldcup.cn
  21.     ssl on;
  22.     ssl_certificate /usr/local/nginx/conf/server.crt;
  23.     ssl_certificate_key /usr/local/nginx/conf/server.key;
  24.     ssl_session_timeout 5m;
  25.     ssl_session_cache shared:SSL:50m;
  26.     ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
  27.     ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  28.     underscores_in_headers on;
  29.     location /login {
  30.         proxy_pass http: // login_websocket; # agent to go to the address above
  31.         proxy_http_version 1.1;
  32.         proxy_set_header Upgrade $http_upgrade;
  33.         proxy_set_header Connection "Upgrade";
  34.     }
  35.  
  36.     location /baseapp0 {
  37.         proxy_pass http: // baseapp_websocket0; # agent to go to the address above
  38.         proxy_http_version 1.1;
  39.         proxy_set_header Upgrade $http_upgrade;
  40.         proxy_set_header Connection "Upgrade";
  41.     }
  42.        
  43.         location /baseapp1 {
  44.         proxy_pass http: // baseapp_websocket1; # agent to go to the address above
  45.         proxy_http_version 1.1;
  46.         proxy_set_header Upgrade $http_upgrade;
  47.         proxy_set_header Connection "Upgrade";
  48.     }
  49.        
  50.         location /baseapp2 {
  51.         proxy_pass http: // baseapp_websocket2; # agent to go to the address above
  52.         proxy_http_version 1.1;
  53.         proxy_set_header Upgrade $http_upgrade;
  54.         proxy_set_header Connection "Upgrade";
  55.     }
  56.  
  57.     #https agreement forwarded small program which you want to access the link
  58.     location /{
  59.     proxy_pass http: // web; # http proxy to the original address to
  60.     proxy_set_header   X-Real-IP        $remote_addr;
  61.     proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  62.     add_header Access-Control-Allow-Origin *; # Set cross-domain access
  63.     }
  64. }
Published 13 original articles · won praise 0 · Views 2296

Guess you like

Origin blog.csdn.net/kbengine/article/details/104882546