• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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