I have an SSR React Router 7 (framework version) Node.js/Express application that I am trying to wire up to a domain, which is running through Linode. I set up my domain on Linode, and updated nameservers on my domain's registrar to point to Linode.
My RR7 application (living on my Linode Ubuntu 24.04 LTS machine) runs fine, but whenever I npm start the app, for example, to test that I can access it through my domain, the domain only shows the nginx welcome startup page, and only if I go to www.mydomain.com:3000 then it does show my app, which does in fact run on port 3000, which makes sense. Just not sure why it’s not working when going directly to mydomain.com.
Here is my nginx config file:
server {
listen 80;
server_name mydomain.com;
location / {
proxy_pass http://localhost:3000;
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;
}
}
I've tested the nginx config and restarted the nginx server, but still can't get this to work. Forgive me if this is not enough info, I just didn't want to add too much to the OP, so if more info is needed, will provide. Thanks!
nginx -Tcommand? Did you checkmydomain.com,www.mydomain.com, or both? The config you've shown won't work for thewww.mydomain.comdomain since you didn't list it in the server names list, so the default server block will be used for it (see the How Nginx processes a request documentation page).nginx -tcommand does come back successful. I tried addingwww.mydomain.comin addition tomydomain.comto theserver_nameblock in the config file, but still not working properly.nginx -tandnginx -Tare two different commands. The first one only checks the configuration file for correctness, while the second additionally outputs the full configuration as nginx sees it. Runnginx -Tto see if your configuration snippet is really included in the full configuration used by nginx.nginx -Tdoes show the configuration I set up for this app/domain...