IIS and Apache canceling directory script execution permissions method

Source: Internet
Author: User
Tags php file

Open the site in IIS, right-click on the site uploads directory, data directory, and static HTML build directory, select "Properties" in the menu, and choose "None" in the Directory Properties panel. (Figure 1)

(Figure 1)


IIS7 is similar to IIS6.0, select the corresponding directory of the site, data, uploads and static HTML file directory, double-click the function to try the panel "handler mapping" (Figure 2)

(Figure 2)
In the Edit feature permission ..., we directly remove the script execution permissions. (Figure 3)

(Figure 3)



In Apache, there is no graphical management interface for IIS under Windows, and we need to manually modify the Apache configuration file to set the execution permissions for the directory script.
First we find Apache's profile httpd.conf, which is typically in the Conf folder under the Apache installation directory (Figure 4).

(Figure 4)
Open the httpd.conf file and find the location of Figure 5 in the content:

(Figure 5)

Add the directory configuration that you want to limit the execution of script files to below


The code is as follows
Copy Code



<directory "DIR" > &nbsp;&nbsp;&nbsp;
<filesmatch ". (php|asp|jsp) $ "> &nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; Deny from all &nbsp;&nbsp;&nbsp;
</FilesMatch>
</Directory>



Dir in configuration content is the directory that needs to limit the execution of script files, and the FilesMatch content is the name of the script suffix that needs to be qualified for execution. For example, to prevent the running of php,asp,jsp scripts under the Uploads folder in the test site, configure the following figure 6:

(Figure 6)

After the configuration is complete, restart Apache, the configuration will take effect!
Before the operation, I created a new index.php file under the Uploads folder, and Figure 7 is not configured for prior access

(Figure 7)
Figure 8 The effect of accessing this page after restarting Apache.


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.