2

Just set up a client's server. I'm running it on a 512 RAM Droplet from DigitalOcean. Hooked up a domain, working great. However I used nginx as a reverse proxy and things got messy.. I've never used nginx before so I thought I'd set it up now just to learn it. However these are the problem I am facing.. I'd like to know about somethings:

Problem 1:

The static files were giving a 404, So I used this answer: https://stackoverflow.com/a/32420078 (with a small change, that was changing "javascript" to "javascripts")

I'd like to know is this the only solution or is there a better solution (why I think there should be better solution, I'll explain at the end)

Problem 2:

So / is working now... But when I go to /dash and that gives a 404. So I got an idea from https://gist.github.com/soheilhy/8b94347ff8336d971ad0 and added

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

And it works. However, do I have to add this for every route

app.use('/dash', dash);

that I define like this?

Full nginx conf

https://pastebin.com/NfihniEs

Why I think there should be a better solution? Because I have formerly used Apache, and all I have to do set up my localhost and port and everything worked perfectly... So, I'd like to know about that.

Also, I used this guide for configuration (also performed prerequisites) https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04

Community
  • 1
  • 1
candh
  • 238
  • 2
  • 13

0 Answers0