The Apache environment rules are as follows: Apache executes PHP script restrictions to add these rules to the. htaccess file
| The code is as follows |
Copy Code |
Rewriteengine on Rewritecond%!^$ Rewriterule uploads/(. *). (PHP) $–[f] Rewriterule data/(. *). (PHP) $–[f] Rewriterule templets/(. *). (PHP) $–[f] |
The NGINX environment rules are as follows: Nginx Execute PHP script restrictions
LNMP has a disadvantage is that directory permissions are not as good as Apache, and sometimes the Web site program has uploaded vulnerabilities or similar pathinfo vulnerabilities, which led to the upload of the PHP trojan, and to the Web site and the server to bring greater danger. It is recommended to remove the PHP permissions from the Site directory and return 403 errors when accessing the PHP file under the upload directory.
To edit the Nginx virtual host configuration First, add the following in front of the fastcgi location statement:
| The code is as follows |
Copy Code |
Location ~/(data|uploads|templets)/.*. (PHP|PHP5)? $ { Deny all; } |
Okay, Nginx's Apache rules are a little different, but not very different.