Apache nginx disables PHP program execution through rewrite settings

Source: Internet
Author: User

A website may have vulnerabilities. The last time a friend's website used an open-source system, the website was infected with Trojans and checked a vulnerability when it was originally used to edit the template, A Trojan is written into the template. Actually

You can use rewrite to set

 

The Apache environment rules are as follows: Apache executes the php script to restrict the Rules to be added to the. htaccess file.

RewriteEngine on RewriteCond %! ^ $
RewriteRule uploads/(. *). (php) $-[F]
RewriteRule data/(. *). (php) $-[F]
RewriteRule templets/(. *). (php) $-[F]

 

Edit the nginx virtual host configuration and add the following content before the location Statement of fastcgi:


Location ~ /(Data | uploads | templets)/. * \. (php | php5 )? $ {
Deny all;
}

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.