nginx sets the method to upload directories without execution permission

  • 2020-05-06 12:13:50
  • OfStack

nginx is also very simple, we use location. As follows:
 
location ~ ^/upload/.*\.(php|php5)$ 
{ 
deny all; 
} 

Where upload is changed to the directory name you want to set

The meaning of this rule is to match pages that start with /upload/, match arbitrary characters in the middle, end with.php or.php5, and finally block access with deny all, thus preventing script execution permission to upload directories

Related articles: