In order to enhance the security of the site, in addition to restricting directory permissions, we also need to disable a directory to prohibit the execution of PHP. In IIS, you can remove script execution permissions for a directory directly, but what about non-Windows systems?
The next article will simply introduce the different webserver How to disable PHP execution ....
Apache:
Copy Code code as follows:
<Directory/website/attachments>
Php_flag engine off
</Directory>
Nginx:
To disable a single directory:
Copy Code code as follows:
location/upload/{
Location ~. *\. (PHP)? $
{
Deny all;
}
}
To disable multiple directories:
Copy Code code as follows:
Location ~* ^/(upload|images)/.*\. (PHP|PHP5) $
{
Deny all;
}
LIGHTHTTPD:
Copy Code code as follows:
$HTTP ["url"] =~ "^/" (Forumdata|templates|customavatars?) /” {
Fastcgi.server = ()
}
Apache
<location "/forumdata" >
Php_admin_flag engine off
options-execcgi
AddType text/plain. html. htm. shtml. php
</Location>