I am deploying a node app to a digitalocean droplet, at the moment when i run the app with the normal 'node' command it doesn't give me any error, however, when i run it with pm2 start it still doesn't give me any error but, when i try to curl the home page it gives me this:
curl http://localhost:4567
curl: (52) Empty reply from server
My app at the moment is running correctly on port 4567 but in the future i would like to use port 80, so if you can help on this even i would really appreciate. I have already searched around the internet for 2 days but still found nothing, if you need additional details feel free to ask!
EDIT #1:
At the moment i am using Nginx as suggested but it is giving me error 502 Bad Gateway.
EDIT #2
This is my nginx default file:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name mydomain.io www.mydomain.io;
location / {
proxy_pass http://localhost:4567;
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;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
My server is running with an ssl certificate if this helps solving the issue.
from Digitalocean Deploying Node: Empty reply from server
No comments:
Post a Comment