lvincek
By:
lvincek

Can't get my basic page to load

April 11, 2017 261 views
Deployment Nginx Ubuntu 16.04

I have come to a complete dead end on getting my app to run.

I was trying to use the following instructions:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

I have tried two different apps in my droplet. The first one was a react app, so I was using 'npm start'. Then, I put a more simple html app in, so 'node app' was sufficient.

In both cases, I was able to get my apps to work on localhost. "npm start", "node app", and then also things such as "pm2 start app" and "pm2 start npm -- start" all worked. So, my app was spun up.

Also, my nginx appears to have at least started. When I goto <ip address>:<port number> or <domain name>.com from a browser on my machine, I get that standard "welcome to NGINX screen".

When I ran the script "sudo nginx -t", it said everything was fine.

I also allowed with "sudo ufw allow 'Nginx Full'"."

my /etc/nginx/sites-available/default reads like:

server {
listen 80;

server_name <domain name>.com;

location / {
    proxy_pass http://localhost:<port>;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

}

I have been through the instructions so many times, and I can't see how I have not followed them to a 't'. Any suggestions on why I can't see my page?

1 comment
  • proxy_pass http://localhost:<port>;
    

    you need to change <port> to the port number your node app is running on

1 Answer
hansen April 11, 2017
Accepted Answer

Hi @lvincek
Did you remember to reload/restart Nginx after you made the changes?
Because you should not be seeing the "Welcome to Nginx" with that configuration.
Normally, it's a good idea to test configuration, then reload/restart if no errors:

sudo service nginx configtest
sudo service nginx reload
  • Thanks all.

    Yes, it was the nginx restart. with that command, everything was working.

Have another answer? Share your knowledge.