【发布时间】:2017-06-14 07:29:27
【问题描述】:
我在 VPS 上运行 node.js API,它由 Ubuntu 13.04 上的 nginx 提供服务。
我正在使用restify 并提供这样的静态文件:
server.get(
/\/static\/?.*/,
restify.serveStatic({
directory: __dirname // => /home/misha/rxviz-api
})
);
这里是来自 nginx 配置的相关位:
server {
listen 80;
server_name api.rxviz.com;
location / {
proxy_pass http://localhost:4010/;
}
}
(完整配置为here)
运行时:
curl http://localhost:4010/static/.well-known/acme-challenge/test.json
在VPS上,我得到test.json的内容。
但是,当导航到:
http://api.rxviz.com/static/.well-known/acme-challenge/test.json
在浏览器中,我得到 404。
nginx 错误日志显示找不到/opt/nginx/html/static/.well-known/acme-challenge/test.json。
为什么 nginx 试图访问 /opt/nginx/html 中的 test.json 而不是 /home/misha/rxviz-api?
还有几点:
-
static目录权限为drwxrwxr-x - 我可以在浏览器中成功访问
http://api.rxviz.com/
【问题讨论】:
标签: node.js ssl nginx lets-encrypt restify