How to set a directory with no execution permission in apache nginx

Source: Internet
Author: User
Tags php tutorial regular expression web services

Apache nginx sets the directory without execution permission. web services include iis, apache, and nginx. The operating system is nothing more than windows or * nux.

 

The code is as follows: Copy code
Location ~ ^/Upload/. *. (php Tutorial | php5) $
{
Deny all;
}

We can see that the two segments usually have no permission for the upload Directory. The configuration is as follows:

The code is as follows: Copy code

<Directory "/var/111cn.net/upload">
<Filesmatch ". php">
Order allow, deny
Deny from all
</Filesmatch>
</Directory>


* Nux is different. Everyone knows that * the nux operating system is case sensitive.

The code is as follows: Copy code
<Directory "/var/www/upload">
<Filesmatch "(? I:. php) "> //? Is to match as many. php strings as possible, I is case-insensitive, followed by a colon followed by a regular expression
Order allow, deny
Deny from all
</Filesmatch>
</Directory>


In addition, let's take a look at the nginx virtual host protection webshell perfect version.

Nginx. conf

The code is as follows: Copy code

Server
{
Listen 80;
Server_name www.a.com;
Index index.html index.htm index. php;
Root/data/htdocs/www.a.com /;

# Limit_conn crawler 20;

Location ~ . *. (Php | php5 )? $
{
# Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude GI. conf;
}

}

Server
{
Listen 80;
Server_name www. B .com;
Index index.html index.htm index. php;
Root/data/htdocs/www.111cn.net /;

# Limit_conn crawler 20;

Location ~ . *. (Php | php5 )? $
{
# Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude GI. conf;
}

}

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.