Can't get Meteor app deployed on Ubuntu (Nginx issue)


#1

I can’t get meteor app deployed on my VPS (It’s new VPS with fresh Ubuntu installation).

I followed well this tutorial:

From A to Z.

But when i test my application i get:


    502 Bad Gateway.

I check status of:


    service nginx status
    status mongodb

It’s ok, but:

status myapp

Return: myapp stop/waiting

Checked the logs:

/home/myapp/myapp.log

There nothing.

Same as mongodb logs.

But found this on nginx logs:


    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 location:


    # 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;
        }
    }

I noticied that port 3000 not opened.


    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

Any one encountred this problem before ? Any fix please ?


#2

if the port 3000 is not opened and you configured the meteor app run with that port, then your meteor app is not running.


#3

What happens when you run the commands in your startup script manually?


#4

Your meteor app is not running. Try:

sudo start appName

and see what happens.

I’m not sure if you need the sudo part.