LNMP canceling the Nginx directory PHP execute permission _php tutorial

Source: Internet
Author: User
First of all, to edit the Nginx virtual host configuration, in front of the FASTCGI location statement, add the following content:

1, single directory remove PHP Execute permissions

Location ~/attachments/.*\. (PHP|PHP5)? $ {

Deny all;

}

Remove PHP execution permissions from the attachments directory.

2. Remove PHP execution permissions from multiple directories

Location ~/(attachments|upload)/.*\. (PHP|PHP5)? $ {

Deny all;

}

Remove the PHP Execute permissions for the two directories attachments, upload.

An example of a complete virtual host is included:

Server

{

Listen 80;

server_name www.45it.com;

Index index.html index.htm index.php;

Root/home/wwwroot/bbs.vpser.net;include discuz.conf;

Location ~/(attachments|upload)/.*\. (PHP|PHP5)? $ {

Deny all;

}

Location ~. *\. (PHP|PHP5)? $

{

Fastcgi_pass Unix:/tmp/php-cgi.sock;

Fastcgi_index index.php;

Include fcgi.conf;

}

Access_log off;

}

Add execution:/usr/local/nginx/sbin/nginx-t Test configuration file, execute:/usr/local/nginx/sbin/nginx-s reload Load the configuration file for it to take effect.

Note: Notice the order, must be placed in "location ~. *\." (PHP|PHP5) $ "line above, otherwise it will not take effect.

http://www.bkjia.com/PHPjc/767401.html www.bkjia.com true http://www.bkjia.com/PHPjc/767401.html techarticle first of all to edit the Nginx virtual host configuration, in front of the FASTCGI location statement to add the following: 1, a single directory remove PHP execution permissions location ~/attachments/.*\. (Php|p ...

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