Windows虛擬主機(jī)禁用腳本執(zhí)行權(quán)限方法
如果您使用的是Windows虛擬主機(jī),需要禁止某個(gè)目錄的腳本執(zhí)行權(quán)限,您可以在要禁用腳本執(zhí)行權(quán)限的目錄建立一個(gè)web.config文件,里面加入下面的代碼:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="ASPClassic" />
<remove name="PHP-FastCGI" />
<remove name="ASPNET-ISAPI-1.1-AXD" />
<remove name="ASPNET-ISAPI-1.1-HttpRemotingHandlerFactory-rem" />
<remove name="ASPNET-ISAPI-1.1-HttpRemotingHandlerFactory-soap" />
<remove name="ASPNET-ISAPI-1.1-PageHandlerFactory" />
<remove name="ASPNET-ISAPI-1.1-SimpleHandlerFactory" />
<remove name="ASPNET-ISAPI-1.1-WebServiceHandlerFactory" />
<remove name="AssemblyResourceLoader-Integrated" />
<remove name="AXD-ISAPI-2.0" />
<remove name="AXD-ISAPI-2.0-64" />
<remove name="HttpRemotingHandlerFactory-rem-Integrated" />
<remove name="HttpRemotingHandlerFactory-rem-ISAPI-2.0" />
<remove name="HttpRemotingHandlerFactory-rem-ISAPI-2.0-64" />
<remove name="HttpRemotingHandlerFactory-soap-Integrated" />
<remove name="HttpRemotingHandlerFactory-soap-ISAPI-2.0" />
<remove name="HttpRemotingHandlerFactory-soap-ISAPI-2.0-64" />
<remove name="PageHandlerFactory-Integrated" />
<remove name="PageHandlerFactory-ISAPI-2.0" />
<remove name="PageHandlerFactory-ISAPI-2.0-64" />
<remove name="Perl-CGI" />
<remove name="Perl-ISAPI" />
<remove name="rules-64-ISAPI-2.0" />
<remove name="rules-Integrated" />
<remove name="rules-ISAPI-2.0" />
<remove name="SecurityCertificate" />
<remove name="SimpleHandlerFactory-Integrated" />
<remove name="SimpleHandlerFactory-ISAPI-2.0" />
<remove name="SimpleHandlerFactory-ISAPI-2.0-64" />
<remove name="svc-Integrated" />
<remove name="svc-ISAPI-2.0" />
<remove name="svc-ISAPI-2.0-64" />
<remove name="TraceHandler-Integrated" />
<remove name="TRACEVerbHandler" />
<remove name="WebAdminHandler-Integrated" />
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="WebServiceHandlerFactory-ISAPI-2.0" />
<remove name="WebServiceHandlerFactory-ISAPI-2.0-64" />
<remove name="xoml-64-ISAPI-2.0" />
<remove name="xoml-Integrated" />
<remove name="xoml-ISAPI-2.0" />
</handlers>
</system.webServer>
</configuration>
保存后就設(shè)置了該文件夾以及子容器只有讀和寫的權(quán)限,而沒有腳本執(zhí)行權(quán)限。如果要恢復(fù)腳本權(quán)限就直接刪除該目錄下的web.config文件。