【问题标题】:Can't get Meteor app deployed on Ubuntu (Nginx issue)无法在 Ubuntu 上部署 Meteor 应用程序(Nginx 问题)
【发布时间】:2018-08-10 15:56:54
【问题描述】:

我无法在我的 VPS 上部署流星应用程序(这是安装了全新 Ubuntu 的新 VPS)。

我很好地遵循了本教程: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx#step-1-%E2%80%94-setting-up-an-nginx-web-server

从 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
  • herehere 描述了一些东西
  • @Jankapunkt 我根据您的要求更新了帖子 :)
  • 为什么要更改proxy_pass

标签: node.js ubuntu nginx meteor ionic-framework


【解决方案1】:

Meteor Up (Source Code) 可以替换教程中的第 4 步,当您需要重新部署时,只需运行 mup deploy 而不是第 5 步。它们甚至提供 SSL 支持。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-14
    • 1970-01-01
    • 2022-11-12
    • 1970-01-01
    • 2012-09-02
    • 2019-03-14
    • 1970-01-01
    • 2023-04-04
    相关资源
    最近更新 更多