@Mobilpadde
Posting this as a separate reply since it’ll be a little lengthy :-).
…
The default server block for NGINX will be located at:
/etc/nginx/sites-available/default
The above file, with NGINX running, is why you’ll see some sort of response to incoming requests after pointing your domain to the IP of the Droplet.
You’ll need to modify that file to suit your specific needs and proxy requests to your NodeJS app. To start, I’d recommend wiping that file clean.
To do that, we can run:
truncate -s 0 /etc/nginx/sites-available/default
That’ll result in an empty file we can now setup to respond to requests for your application. So let’s go ahead and edit it.
nano /etc/nginx/sites-available/default
Within that file, paste in:
upstream @backend {
server 127.0.0.1:3000;
}
server
{
listen 80;
listen [::]:80;
server_name domain.com www.domain.com;
location /
{
proxy_pass http://@backend;
proxy_buffers 16 32k;
proxy_buffer_size 64k;
proxy_busy_buffers_size 128k;
proxy_cache_bypass $http_pragma $http_authorization;
proxy_connect_timeout 59s;
proxy_hide_header X-Powered-By;
proxy_http_version 1.1;
proxy_ignore_headers Cache-Control Expires;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
proxy_no_cache $http_pragma $http_authorization;
proxy_pass_header Set-Cookie;
proxy_read_timeout 600;
proxy_redirect off;
proxy_send_timeout 600;
proxy_temp_file_write_size 64k;
proxy_set_header Accept-Encoding '';
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $host;
proxy_set_header Proxy '';
proxy_set_header Referer $http_referer;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Original-Request $request_uri;
}
}
You’ll need to modify:
server_name domain.com www.domain.com;
…and replace domain.com
with your actual domain name.
Once you’ve done that, save the file and restart NGINX using:
service nginx restart
That should get things working for you without having to attach the port to the URL.