【发布时间】:2019-01-22 08:04:53
【问题描述】:
我正在尝试从我的公共目录中提供 css、img 和 js 静态文件(我在此目录中没有任何 html),因此我配置了我的 nginx 服务器指令,如下所示:
server {
listen 80;
listen [::]:80;
server_name my-site.com;
root /home/myuser/site/public;
location / {
proxy_pass "http://localhost:3000";
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
但是 nginx 服务器抓取所有对“/”的请求并尝试给我静态文件,所以我没有从节点看到我的 index.html。如何在“/”路由上渲染我的 index.html?
【问题讨论】:
标签: javascript html node.js nginx caching