因此,我在 nginx 后面设置了 express.js,当我转到 时website.com/users
,我得到了 404。但是当我转到 时website.com
,页面加载正常。这似乎也是所有其他路由的问题,我都无法访问website.com/public/css
。这是我的 nginx 配置
upstream default {
server 127.0.0.1:3000;
keepalive 8;
}
server {
listen 0.0.0.0:80;
listen [::]:80 default_server ipv6only=on;
root /var/www/;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name website.com default;
access_log /var/log/nginx/default.log;
return 301 https://website.com$request_uri;
location / {
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_pass http://default/;
proxy_redirect off;
}
}
有任何想法吗?