【发布时间】:2018-08-10 15:56:54
【问题描述】:
我无法在我的 VPS 上部署流星应用程序(这是安装了全新 Ubuntu 的新 VPS)。
从 A 到 Z。
但是当我测试我的应用程序时,我得到:
502 Bad Gateway.
我检查以下状态:
service nginx status
status mongodb
没关系,但是:
status myapp
返回:myapp stop/waiting
查看日志:
/home/myapp/myapp.log
什么都没有。
与 mongodb 日志相同。
但是在 nginx 日志上发现了这个:
2018/03/02 01:08:19 [error] 2651#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server: 185.12.85.65, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "185.12.85.65"
2018/03/02 02:57:11 [error] 2653#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server: 185.12.85.65, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "185.12.85.65"
2018/03/02 12:52:16 [error] 2655#0: *25 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server: 185.12.85.65, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "185.12.85.65"
Nginx 位置:
# pass all requests to Meteor
location / {
proxy_pass http://127.0.0.1:3000;
#proxy_pass http://0.0.0.0:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# this setting allows the browser to cache the application in a way compatible with Meteor
# on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
# the root path (/) MUST NOT be cached
if ($uri != '/') {
expires 30d;
}
}
我注意到 3000 端口没有打开。
PID/Program name
tcp 0 0 127.0.0.1:28017 0.0.0.0:* LISTEN 787/mongod
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 784/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 6578/nginx
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 787/mongod
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6578/nginx
tcp6 0 0 :::22 :::* LISTEN 784/sshd
tcp6 0 0 :::80 :::* LISTEN 6578/nginx
以前有人遇到过这个问题吗?请问有什么办法吗?
【问题讨论】:
-
你能显示你的匿名 nginx 位置配置吗?
-
请您再解释一下好吗?你是什么意思 ?您的意思是这个位置:
/etc/nginx/sites-available/myapp? -
@Jankapunkt 我根据您的要求更新了帖子 :)
-
为什么要更改
proxy_pass?
标签: node.js ubuntu nginx meteor ionic-framework