Nginx Directory Access script is forbidden

Source: Internet
Author: User
Tags php class svn

Here are some of the Nginx prohibit SVN directory access to the script, I hope these scripts will help you learn Nginx oh.

Nginx

Location ~. *. (SVN|GIT|CVS) {
Deny all;

}

Apache

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

Rewriteengine on

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

To organize some methods for everyone to refer

Disable access to certain files/directories

Add the Files option to control, such as not allowing access to the. inc extension file, to protect the PHP class library:

<files ~ ". inc$" >
Order Allow,deny
Deny from all
</Files>

Prohibit access to certain specified directories: (can be used for regular matching)

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

Prohibit by file matching, such as prohibiting all access to images:

<filesmatch. (? i:gif|jpe?g|png) $>
Order Allow,deny
Deny from all
</FilesMatch>

Forbidden access for URL-relative paths:

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

Prohibit access to certain destinations (which can be used for regular matching) for proxy, such as denying access to 111cn.net through proxies:

<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.