I'm trying to deploy a Nuxt App on Digital Ocean over Nginx with pm2. When I go to the droplet IP I can see the Nginx welcome page but when I try to go to the IP:PORT of the Nuxt App it says:
This site can’t be reached
167.xx.xxx.xxx refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
I have added this on sites-available/default file:
server {
server_name domain.com;
location / {
proxy_pass http://localhost:7200;
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;
}
}
After this I checked for nginx status and restarted it.
Also, I added the service on pm2 with pm2 start --name="webapp" npm -- start and I can see it running correctly.
Even I have tried running directly npm run start command but I get the same result.
Hope you can help me.
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}