Scripts for nginx disabling svn directory access

Source: Internet
Author: User
Tags php class regular expression svn

Nginx

Location ~ . *. (Svn | git | cvs ){
Deny all;


}

Apache

<Directory "/opt/www/svip/gift/webroot">

RewriteEngine On

RewriteRule. svn // 404.html
</Directory>

I sorted out some methods for your reference.

Prohibit access to some files/Directories

Add the Files option to control, for example, do not allow access to Files with the. inc extension, and protect the php class library:

<Files ~ ". Inc $">
Order allow, deny
Deny from all
</Files>

Prohibit access to some specified directories: (you can use it for regular expression matching)

<Directory ~ "^/Var/www/(. +/) * [0-9] {3}">
Order allow, deny
Deny from all
</Directory>

Prohibit by file matching, for example, prohibit all accesses to images:

<FilesMatch .(? I: gif | jpe? G | png) $>
Order allow, deny
Deny from all
</FilesMatch>

Prohibit access to the relative URL path:

<Location/dir/>
Order allow, deny
Deny from all
</Location>

Deny access to certain targets (which can be used for regular expression matching) in proxy mode. For example, deny access to 111cn.net through proxy:

<Proxy http://www.111cn.net/*>
Order allow, deny
Deny from all
</Proxy>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.