This article mainly introduces the Apache Nginx ban Directory execution php script file method, the content is very good, and now share to everyone, but also for everyone to make a reference.
When we build our website, we may need to set permissions on some directories individually to achieve the security we need. Below is an example of how to disable a directory execution PHP file under Apache or Nginx.
1.Apache Configuration
<Directory/apps/web/renwole/wp-content/uploads> Php_flag engine off</directory><directory ~ "^/apps/ Web/renwole/wp-content/uploads "> <files ~". php "> Order allow,deny deny from all </files></directory >
2.Nginx Configuration
location/wp-content/uploads {location ~. *\. ( PHP)? $ { deny all; }}
Nginx prohibits multiple directories from executing PHP:
Location ~* ^/(css|uploads)/.*\. (PHP) ${ deny all;}
After the configuration is complete, reload the configuration file or restart the Apache or Nginx service, and all access to the PHP file via uploads will return 403, greatly increasing the security of the Web directory.
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!