有很多关于NGINX和Meteor.js的帖子(使用mup)。但是,他们似乎都没有解决我的问题。我无法让NGINX虚拟主机将其正确转发到我的应用程序所在的DigitalOcean Droplet上。
这是我的mup.json:
{
"servers": [
{
"host": <IP-address>,
"username": "root",
"password": <root pwd>
}
],
"setupMongo": true,
"setupNode": true,
"nodeVersion": "0.10.36",
"setupPhantom": true,
"enableUploadProgressBar": true,
"appName": myapp,
"app": ".",
"env": {
"ROOT_URL": "http://localhost",
"PORT" : 3000,
"METEOR_ENV": "development"
},
"deployCheckWaitTime": 15
}
然后,在我的Droplet上,我删除了/etc/nginx/sites-enabled/default
并创建了:/etc/nginx/sites-enabled/myapp.com.conf
以及网站中可用的sym-link,如下所示:
server {
listen *:80;
server_name myapp.com;
access_log /var/log/nginx/app.dev.access.log;
error_log /var/log/nginx/app.dev.error.log;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
}
重新启动NGINX后,当我在本地执行mup deploy
时,无法部署消息Failed to connect to localhost port 3000: Connection refused
,即无法将应用连接到小滴上。
我已经在墙上撞了好几天,任何想法可能是什么问题?