I have an nginx reverse proxy setup to point to my nodejs app. When I enter the server IP in the search bar, the website pulls up as expected. When I enter the domain name I get an ERR_CONNECTION_REFUSED error.
I have the following sites-available file for my site:
server {
listen 80 default_server;
listen [::]:80;
server_name mywebsite.com www.mywebsite.com <server_ip>;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://0.0.0.0:3000/;
#proxy_redirect http://127.0.0.1:3000/ https://$server_name/;
}
}
I've also commented out everything in the default
file to avoid conflict.
My ports should be open per ufw
:
$ sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
Nginx Full ALLOW Anywhere
443 ALLOW Anywhere
22 ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
When I do a ping on my domain name, it returns the correct IP address.
This is the output of netstat -tlnp
sudo netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 21671/PM2 v5.3.0: G
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 18646/sshd: /usr/sb
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26697/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 18657/systemd-resol
tcp6 0 0 :::22 :::* LISTEN 18646/sshd: /usr/sb
tcp6 0 0 :::80 :::* LISTEN 26697/nginx: master