where is the root directory of website?
-
I know a lot has been changed since this topic has been posted. I am in need of placing a file specifically ads.txt on the root of the forum (as advised by google adsense to stay compliant).
However all i am able to do is to get it up like example.com/assets/ads.txt by placing it in the public directory.
Any one knows how can it be served at example.com/ads.txt?
-
@fais3000 you can use your reverse proxy to serve the file.
-
I have been a bit curious about this as well. 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, eh?
P.S.; Maybe should have started a new thread proper under Technical Support. Please feel free to fork.
-
-
@fais3000
Error 502 Ray ID: 4ff5f65b4b26d3fb • 2019-08-01 07:05:12 UTC
Bad gateway
after add location file in default configuration. -
Looks like you are getting a Ray ID error. I might guess you're hosting some stuff via Cloudflare? In wh/case maybe this helps.
In any event, impossible to guess w/o more details. Good luck. o/
-
@gotwf
Cloudflare using only for CDN, nothing host there. all firewall and other settings check. but same issue.
working well @ assets/ads.txtlocation /ads.txt { root /var/www/nodebb/public/; }
but after add root in default configuration this error showing"domain/ads.txt"
-
@Zahid-Asim Obviously not firewall issue else all requests accessing via port xyz would be blockaded. Hence => must be something configuration side: Either yours or Cloudflare.
Maybe try(??):
location ~^/ads.txt {
root /var/www/nodebb/public/;
}I don't use Cloudflare so no clue what might be happening on their end. Good luck.
P.S.; Otherwise you need to post your entire nginx.conf cuz despite my best efforts I is not a mind reader.