我正在尝试让我的node服务器在 Ubuntu 14.04 上启动并运行。我按照 DigitalOcean 的教程设置 nginx 和服务器块来提供我的内容。
我有正确的服务器设置,我相信因为我可以 whois my-site.com
也可以 ping my-site.com
。当我在浏览器中访问网址时,我得到的只是页面中显示的这个错误:“内部错误:缺少模板 ERR_CONNECT_FAIL”。
我想也许我将 nginx 服务器块指向了不正确的路径,因为“缺少模板”,但它指向了正确的文件。它应该显示一个位于 /var/www/my-site.com/html 中的简单 index.html 文件。
这是我的服务器块,如果这可以说明错误:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=off;
root /var/www/my-site.com/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name my-site.com www.my-site.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
该文件位于 /etc/nginx/sites-available/my-site.com 中,我也将其复制到启用站点的目录中。
我在这里想念什么?
这是一条非常标准的错误消息,事实上,此时 nodejs.org 正在显示完全相同的消息。我相信它是由反向代理生成的:例如, https://searchcode.com/?q=ERR_CONNECT_FAIL 表明
ERR_CONNECT_FAIL
出现在 [squid reverse proxy software](https://en.wikipedia.org/wiki/Squid_(software) 中)。我找不到类似快速 search through the nginx source code 的东西。当我遇到此错误消息时,我正在通过 digitalocean 一键式 dokku 应用程序进行部署,并且我在
/home/dokku/VHOST
中没有域,因此它被分配了一个随机的内部 IP 地址。我使用 [domain]:[port] 访问它。希望能给你一个线索。