DEV Community

Discussion on: Connecting my domain name on digital ocean droplet

chiefnoah profile image
Noah Pederson

For starters, your nginx configuration was correct and was behaving in an expected way. When you specify a hostname in the server_name field, it will only handle requests where the Host header is set to that hostname. To have nginx use the proxy_pass for everything, use default_server instead of the hostname:

server {
   listen 80;
   server_name default_server;

   location / {
      proxy_pass http://localhost:3000;

Remember to restart nginx after updating the configuration :)