jlengstorf / code.lengstorf.com

A blog for me to nerd the fuck out.
https://code.lengstorf.com
ISC License
7 stars 3 forks source link

Node.JS DigitalOcean routing problem #13

Closed MichaelUyy closed 8 years ago

MichaelUyy commented 8 years ago

I am encountering a problem where if I access other pages of my website. I will be sent to the 404 page. Now i believe that there is just a piece of code that is missing at the etc/nginx/sites-enabled/default file since I think that it is only configured for the index page.

Here is my github repo: https://github.com/MichaelUyy/michaeluyme

And here is the guide that I have followed all through out: https://code.lengstorf.com/deploy-nodejs-ssl-digitalocean/

My question here is how do I configure nginx for me to be able to access other pages of my website.

If anyone can help me here, that would be great. Thanks

jlengstorf commented 8 years ago

A couple questions to start:

  1. Are you getting the 404 in your repo? Or the Nginx 404?
  2. Does your sites-enabled exactly match the example in the tutorial? If not, please share it.

This may fall outside the scope of the tutorial, but if I can spot the issue I'll try to help.

MichaelUyy commented 8 years ago

Hi Jason,

I am getting the 404 on my repo and yes, I have my configuration for nginx exactly as what you have included in the guide

jlengstorf commented 8 years ago

If you're getting the 404 from your app, that suggests that it's not Nginx. I'd recommend looking into Express routing on Stack Overflow to see where the issue lies. You could also try logging all the things; maybe it's a file path issue?

Whatever it is, I'm pretty sure this isn't an Nginx configuration issue since the routes are sending you a 404 through Express.

I think that's about as far as I can go, though; we're moving into Express support, which is outside the scope of this app. I'm going to close this issue, but if it turns out I'm wrong and it is an issue with Nginx, let me know here and we'll revisit this.

Good luck!

MichaelUyy commented 8 years ago

I actually opened this issue with stackoverflow as well and one response said that it was an issue with nginx since everything on my server.js turned out to be fine.

http://stackoverflow.com/questions/40573567/express-js-with-node-js

MichaelUyy commented 8 years ago

Also a quick update. I have just recently viewed the error.log file and it shows that the other pages are not found on their directories even though they are actually there.

MichaelUyy commented 8 years ago

Another update. I have placed one of my html files to the main directory. For the URL, I tried accessing michaeluy.me/resume.html and it works. However, how do I get rid of the file extension?

jlengstorf commented 7 years ago

Hey, @MichaelUyy — I see that you found a solution here: http://stackoverflow.com/questions/40573567/express-js-with-node-js

Glad to hear you got it worked out!