server { listen 80; server_name apptest.wildfirechat.cn; rewrite ^(.*)$ https://apptest.wildfirechat.cn permanent; location ~ / { index index.html index.php index.htm; } } server { listen 443 ssl; server_name apptest.wildfirechat.cn; root html; index index.html index.htm; client_max_body_size 30m; #文件最大大小 ssl_certificate cert/app.pem; ssl_certificate_key cert/app.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ## 不需要添加 add_header Access-Control-Allow-Origin $http_origin; 等添加跨域相关 header 的配置,app-server 已经处理了跨域了,所有请求透传过去即可 ## ## send request back to app server ## location / { # 扫码超时时间是 1 分钟,配置了大于一分钟 proxy_read_timeout 100s; proxy_pass http://127.0.0.1:8888; } ## 如果需要通过 path 来分流的话,请参考下的配置,path后面的/和 8888 后面的/ 都不能省略,否则会提示 没有登录 # 可参考这儿:https://www.jb51.net/article/244331.htm #location /app/ { # proxy_pass http://127.0.0.1:8888/; #} }