CmsWing icon indicating copy to clipboard operation
CmsWing copied to clipboard

根据文档的nginx.conf 配置问题

Open sonygod opened this issue 5 years ago • 0 comments

步骤:

1 按照文档配置完善,正常ip+8360可以访问 例如 http://127.0.0.1:8360

2:按照这里的https://www.cmswing.com/p/404.html 使用nginx配置,另存为shop.conf软连接

include shop.conf; 

nginx -t 测试没有问题,重启

3:访问域名http://xxx.com/index.js 提示404

我的shop.conf

server {
listen 80;
server_name www.mygame.com;
root /home/wwwroot/default;
set $node_port 8360;
index index.js index.html index.htm;
if ( -f $request_filename/index.html ){
    rewrite (.*) $1/index.html break;
}
if ( !-f $request_filename ){
    rewrite (.*) /index.js;
}
location = /index.js {
    proxy_http_version 1.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://127.0.0.1:$node_port$request_uri;
    proxy_redirect off;
}
location ~ /static/ {
    etag         on;
    expires      max;
}

}

sonygod avatar Jan 13 '19 08:01 sonygod