静态页没问题,但是经过express的路由跳转后,就报404.
- 以下是nginx的配置文件。 upstream weixin { server localhost:3000; }
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
server_name localhost;
location /weixin/{
proxy_pass http://weixin;
}
location / {
proxy_set_header X-Real-IP ~Dremote_addr;
proxy_set_header X-Forwarded-For ~Dproxy_add_x_forwarded_for;
proxy_set_header Host ~Dhttp_host;
proxy_set_header X-NginX-Proxy true;
}
node直接监听的3000.
var app = express(); app.enable(‘trust proxy’); app.listen(process.env.PORT || 3000);
本地访问也正常
- app.get('/getUserInfo’, Users.userFindByName);
- 求大神帮忙。
8 回复