Nginx Best Practices Directory and Location Configs

Technical Support
  • Not an nginx guru so please bear with me here.

    • For simplicity sake let's assume site lives at forums.example.com rather than a example.com/forums subfolder.

    • Unless specified otherwise, nginx root dir is /usr/share/nginx/html

    • Nodebb nginx configuration docs utilize this when describing setting up a custom error page.

    • Nginx is being used exclusively as reverse proxy and not serving any additional sites. I think I read somewhere that under such configuration an explicit default server docroot should not be specified? But even in such cases I think the hard coded default /usr/share/nginx/html still serves up 50x.html error page.

    • In absence of a custom error page, nodebb uses nodebb/public/503.html?

    • Nginx has been configured for scaling.

    • Nginx Pitfalls and Common Mistakes documentation suggest putting doc root inside a location block is bad practice even though it will work.

    Soo... now my question... taking all of above into consideration.. what is proper/correct best practice configuration for a "scaled" nginx nodebb deployment? I know what "could" work. I am curious what "should" be recommended best practice.

    (Yeah, I know I already posted this in a different thread but it was a mistake at the time not to have started a new thread because this is pretty specific w.r.t. best practices configuration rather than "why isn't my stuff isn't working" question. Apologies for that.)


Suggested Topics