• Inviting everyone who uses WordPress management tools in Plesk
    The Plesk team is conducting a 60-minute research session that includes an interview and a moderated usability test.
    To participate, please use this link .
    Your experience will help shape product decisions and ensure the tools better support real-world use cases.

How to prevent apache from serving the .git directory?

xxx

Basic Pleskian
Hello together.
I'm running Plesk 12.5 Update 10 on a Ubuntu 14 machine. We startet to offer all users to use git as version control system. It works finde.
But, I can access directly into directories and files that start with a full stop - so also into .git directories. I have to prevent apache from serving all files and directories which starts with a full stop. I will do it by a global configuration. But I have no idea which file I have to modify so each existing and new webhosting gets the rule.
Can somebody point me to the right file, please?
Thanks a lot in advance!
 
Hi xxx,
what about adding something like...

Plesk > Subscriptions > domain.tld > Apache & nginx Settings > Additional directives for HTTP & in HTTPS

Code:
<Files .git>
     Require all denied
</Files>

And

Code:
<Directory "/var/www/vhosts/domain.tld/httpdocs/.git">
     Require all denied
</Directory>

Hope it helps
Regards

Lloyd
 
Thank you, Lloyd.
But, as I wrote, I look for a solution for ALL files and directories which starts with a full stop. And, a solution for ALL hostings. Without individual settings for each domain. And settings, wich are also set for upcomming hostings.
Do you have an idea how and where to set up the rules for this topic?
Thanks!
 
Back
Top