同一台Linux服务器多端口的Nginx负载均衡

具体配置描述参考: https://www.jianshu.com/p/09a353537890

upstream appserver{
        ip_hash;
        server 127.0.0.1:8090;
        server 127.0.0.1:8091;
        server 127.0.0.1:8092;
   }
   server {
       listen 443 ssl;
       server_name m.yexun.com;    
       
       ssl_certificate /usr/etc/1996477_m.yexun.com.pem;
           
       ssl_certificate_key /usr/etc/1996477_m.yexun.com.key;       

       ssl_session_cache   shared:SSL:1m;
       ssl_session_timeout 5m;
       ssl_protocols   TLSv1 TLSv1.1 TLSv1.2;
       ssl_ciphers   EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
       ssl_prefer_server_ciphers on;
     
       location / {
           proxy_pass http://appserver;    
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
           proxy_set_header X-Forwarded-Port $server_port;
           proxy_connect_timeout 5;
           proxy_read_timeout 10;
           proxy_send_timeout 60;  
     }
     location ^~ /assets/ {
        root  /usr/etc/images/;
      }
     location = /YAmZVOlDB8.txt {
        rewrite ^/(.*)$ /assets/$1 last;
     }
   }
    server {
       listen 80;
       server_name m.yexun.com;
       return 301 https://$server_name$request_uri;
       tcp_nodelay     on;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header REMOTE-HOST $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
    

你可能感兴趣的:(同一台Linux服务器多端口的Nginx负载均衡)