Windows2003+IIS7 Express使用FastCgi运行php
我要评论2015/02/28 10:38:39 来源:绿色资源网编辑:www.downcc.com 评论:0点击:394次
想在windows 2003中好好跑php,又要节省内存,真是很为难的事情,考虑到IIS7.5 Express可以在WIN2003上跑,不但能以fastcgi的方式支持php,还自带Rewrite组件,只需简单改改web.config的rule规则就可以了。
于是下载了IIS7.5 Express后,安装,还需要对applicationHost.config进行配置,首先得找到这个文件在哪里,如果能在"我的文档"中IIS7Express目录下找到,那就是它了,否则应该就是在IIS7 Express的安装目录下。
1、先修改:defaultDocument节,加入< add value="index.php" />
<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
<add value="index.php" />
</files>
</defaultDocument>
2、找到fastcgi节。
<fastCgi>
<application fullPath="C:\php\php-cgi.exe" monitorChangesTo="php.ini" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:Program Files (x86)iis expressPHPv5.4" />
</environmentVariables>
</application>
</fastCgi>
3、找到handlles,加入
<add name="PHP_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Either" />
尤其要注意的一是,这一句最好加在最前面,也就是在<handlles>下面的第一句,避免被其它Handle抢先处理了。
以上配置中,C:\php\php-cgi.exe 的部分替换成自己的php文件夹中的php-cgi.exe的位置。
4、在<site>配置节下,直接修改站点信息,或直接用appcmd.exe add site来添加站点。
5、找到诸如wordpress的安装文件夹,创建一个web.config文件,在configuration配置节下,添加Gzip压缩规则。
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
</system.webServer>
6、同样在web.config中,Wordpress的rewrite完整的web.config文件内容如下:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
</system.webServer>
</configuration>
这样就完全配置完毕了,然后在IIS7 Express目录下,找到IISExpress.exe,直接双击运行,或者用命令行来执行指定加载哪个站点.
iisexpress.exe /site:'站点名称1"
iisexpress.exe /site:'站点名称2"
访问一下,就会发现访问速度比在windows下使用apache要快得多,而且少跑一个nginx,内存占用整体上也少了很多。
关键词:Windows2003,IIS7,FastCgi,php
相关阅读
- 04-05win2003序列号大全|windows2003 sp2经测试可用的序列号(标准版与企业版)
- 11-14windows2003 + IIS6.0 环境下以Fastcgi方式配置php 5.3.3
- 03-14Windows2003企业版IIS6上配置asp.net4.0网站
- 10-07手机站Windows2003 IIS MIME类型设置大全
- 04-05apache在windows2003下的安全设置(文件夹目录权限安全设置)
- 09-20在windows2003安装网络流量监控软件简明教程
- 11-28Windows2003 建立WEB服务器
- 10-02去除Windows2003登录CTRL+ALT+DEL
- 01-22windows2003服务器上IIS占用CPU资源100%的解决办法
- 08-05系统加速解决方案之Windows2003
阅读本文后您有什么感想? 已有 人给出评价!
用户评论
热门评论
最新评论
相关软件
热点图文
- 04-04用Win 2003 server打造安全的个人Web服务器
- 02-01apache配置<Files>< FilesMatch>< Location><LocationMatch>指令
- 06-30nginx 301 302重定向跳转配置教程
- 11-10用Apache架设Web服务器
- 04-05Apache 服务器的安装教程
- 06-04HTTP 错误 403.6 - 禁止访问:客户端的 IP 地址被拒绝。
- 09-23linux修改php.ini后重新加载配置文件命令
- 12-12IIS支持任意扩展名下载的方法
- 04-04win2008 iis7 设置取消 执行“纯脚本”权限,禁止上传木马
- 05-04Apache+PHP和Tomcat网页乱码问题