Skip to main content Digital Ocean Trouble with Nginx : r/sysadmin
r/sysadmin icon
Go to sysadmin
•

Digital Ocean Trouble with Nginx

Hi everyone. I'm trying to setup a mern stack application on a digital ocean droplet. I went with their Mern Droplet option since it comes with everything installed out of the box.I have things like the ufw firewall setup, and for testing I opened a few ports to test. I have cloned my server app and was able to set it up with PM2. It successfully connects to the database and if I hit the port it is on I can view the page.

However the default page remains their "Welcome to your MERN droplet!" With a picture of a shark. I thought that setting up nginx I should hit the default page under /var/www/html (which is a page that says nginx is working) I had followed the Nginx server block guide and was going to point it to other sites, but at this point it isn't even pointing to the default.

But I don't see why it isn't defaulting to var/www/html. The splash screen is located in /home/mern/client but how would I make it redirect to /var/www/html.

Also I had attempted just running an npm run dev on my react front end client folder it is running and on port 5173 if I hit that port it does not work (unlike the server that I can reach via its port.) I know that I will eventually create a react build and then place that in the folder, but should it be possible to run it in dev and hit it that way?

Archived post. New comments cannot be posted and votes cannot be cast.
Windows Server Security 101: 5 Strategies to Keep Threats Out
Thumbnail image: Windows Server Security 101: 5 Strategies to Keep Threats Out
Sort by:
Best
Open comment sort options

you'll want to look up reverse proxying and configuring nginx to reverse proxy to said app.

You have to check the NGINX Configuration in /etc/nginx/sites-available etc. You most likely need to pass a proxy pass directive for the port umber your main web app is set to. I know alot of the quickstart Digital Ocean droplets do include an all in one solution, like NGINX with letsencrypt. Although too many unknowns just from what you wrote.

Can you access this site from a local IP:portnumber? It this a public facing site? I can forward instructions from an NGINX article I wrote for my blog if you want. Long as you tell me what address is currently can be reached at directly locally, I Can give you instructions, even if that means nuking everything and starting over.

So I had one the one click install mern droplet option digital ocean has: https://marketplace.digitalocean.com/apps/mern.

It comes preconfigured and it has an example mern application. Under /home/mern/ there is a client folder and a server folder.

I have checked nginx configuration and everything there should be pointing to /var/www/html My problem is I can't seem to find what is redirecting it to where they have their sample mern application.

More replies
More replies