小程序的nginx配置

# WebSocket 配置
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

upstream tornadoes {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
    server 127.0.0.1:8003;
}

server {
        listen 443;
        server_name wx.coderr.cn; # 改为绑定证书的域名


    #access_log  /var/log/nginx/https_wx_access.log  main;


        # ssl 配置
        ssl on;
        ssl_certificate wx_ssl/1_wx.coderr.cn_bundle.crt;
        ssl_certificate_key wx_ssl/2_wx.coderr.cn.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;

        # WebSocket 配置
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

    # 静态文件的配置
        #location /static/ {
        #    root /tmp/pycharm_project_deploy/;
        #    if ($query_string) {
        #        expires max;
        #    }
        #}

        location / {

      proxy_pass_header Server;
      proxy_redirect off;
      proxy_set_header X-Scheme $scheme;

          proxy_set_header X_FORWARDED_PROTO https;
      proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      real_ip_header X-Real-IP;
          #proxy_pass http://127.0.0.1:8000;
      proxy_pass http://tornadoes;
        }
    }

你可能感兴趣的:(Linux-系统运维)