zoukankan      html  css  js  c++  java
  • 针对Windows Server 2008 Web 服务 IIS+php 配置的一些心得

    IIS中的配置大多都可以体现在对访问日志下的web.config中。

    一、部署
    对于IIS7以上的可以直接进入https://www.microsoft.com/web/downloads/platform.aspx 该网站下载Microsoft Web Platform Installer 5.0,直接搜索php,选择自己的目标版本点击添加,然后点击安装即可。

    二、配置:
    以下配置均需要要加入如下结构中:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <!-- 代码添加区域 -->
    </configuration>
    
    
    1. rewrite 方法使用示例
      rule.name里的内容要唯一,否则报错。
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rewrite to Lyprx">
                    <match url="^Lyprx/(.*)$"/>
                    <action type="Rewrite" url="{R:1}"/>
                </rule>
                <rule name="Rewrite to PHP">
                    <match url="." ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>    
    
    1. 禁止脚本执行
      这里以禁止执行php脚本为例。可以将代码单独完成的web.config文件放入需要禁止执行脚本的文件目录下。
    <system.webServer>
        <security>
            <requestFiltering>
                <fileExtensions>
                    <add fileExtension=".php" allowed="false" />
                </fileExtensions>
            </requestFiltering>
        </security>
    </system.webServer>    
    
    -----------------------------------------------------
    说明:
      a).代码仅供学习交流
      b).本文根据自身经验及网络总结所作,如有错误,谢谢指教
      c).转载请注明出处。
    -----------------------------------------------------
  • 相关阅读:
    UVa-10317
    UVa-1595
    UVa-10391
    UVa-10763
    UVa-10935
    UVa-1594
    UVa-1593
    从CSDN搬过来了
    memset会显著增加时间和空间的消耗吗
    memset对数组的初始化
  • 原文地址:https://www.cnblogs.com/xqbumu/p/6600574.html
Copyright © 2011-2022 走看看