I have a server where nearly 50 different websites are hosted.
Each of them has a separate Nginx config file all of them are listening on port 443 with a different server_name
and I want to block a certain location
for all websites.
Is there a way that I can add a rule in nginx.conf
which is being applied for all the websites, like a parent rule? I tried listening on 443 in nginx.conf
without any server_name
and set the location
and denying the request, but it blocked all the other configs.
Please suggest a solution such that I can block the .git
folder and all paths starting with dot to be blocked by Nginx for all website instead of changing in each and every config file.