Question
How To Restrict Multiple Directories With Nginx But Still Access Files?
I would like to know how to let people access files with a direct link on my server but restrict them from accessing all directories?
Exemple:
I want them to see
www.site1.com/usa/newyork/1.html
I don't want people to be able to access either
www.site1.com/usa/ nor www.site1.com/usa/newyork
I have tried;
command: sudo nano /etc/nginx/sites-available/site1.com
...
location ~ /(usa) {
deny all;
return 404;
}
...
But after that I can't access the rest myself... even with a direct link: www.site1.com/usa/newyork/1.html
Thank you for your help,
Octav
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×