禁止 web页面访问 .git 文件夹
Nginx
- location ^~ /.git {
- return 404;
- }
Apache 2.2
- <Directory “/home/data/www/htdocs/made/.git”>
- Order Deny,Allow
- Deny from all
- </Directory>
Apache2.4
- <Directory “/var/www/html”>
- #
- # Possible values for the Options directive are “None”, “All”,
- # or any combination of:
- # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
- #
- # Note that “MultiViews” must be named *explicitly* — “Options All”
- # doesn’t give it to you.
- #
- # The Options directive is both complicated and important. Please see
- # http://httpd.apache.org/docs/2.4/mod/core.html#options
- # for more information.
- #
- Options FollowSymLinks
- #Options Indexes FollowSymLinks
- #
- # AllowOverride controls what directives may be placed in .htaccess files.
- # It can be “All”, “None”, or any combination of the keywords:
- # AllowOverride FileInfo AuthConfig Limit
- #
- AllowOverride All
- Order deny,allow
- Allow from all
- #
- # Controls who can get stuff from this server.
- #
- Require all granted
- </Directory>