iis下能部署PHP网站,其操作方法是:1、启动IIS服务器,打开IIS服务器;2、创建网站;3、点击“处理程序映射”,点击右侧的“添加映射模块”;4、添加默认文档,输入“index.PHP”;5、使用URL重写即可。
本文操作环境:Windows7系统、PHP7.1版、DELL G3电脑
在IIS上部署PHP网站
部署网站前查看一下系统是否已经安装CGI
2、创建网站
点击“添加网站”后,进入页面填写网站相关内容,如:网站名称、物理路径(网站所在文件夹),点击“确定”创建成功
3、PHP设置
点击创建好的网站,点击“处理程序映射”,点击右侧的“添加映射模块”,在弹出层中输入对应的参数,点击确认
设置默认文档
点击“默认文档”,鼠标右击“添加”按钮,添加默认文档,输入index.PHP,点击“确定”添加
4、安装urlrewrite
5、使用URL重写
点击“URL重写”,点击右侧的“导入规则”,选择要导入的规则文件,点击应用即可
应用规则后,网站所在根目录会生成一个web.config文件,我这个用的是thinkPHP的.htaccess文件导入的规则
<?xml version=1.0 encoding=UTF-8?> <configuration> <system.webServer> <rewrite> <rules> <rule name=已导入的规则 1 stopProcessing=true> <match url=^(.*)$ ignoreCase=false /> <conditions logicalGrouping=MatchAll> <add input={REQUEST_FILENAME} matchType=IsDirectory ignoreCase=false negate=true /> <add input={REQUEST_FILENAME} matchType=IsFile ignoreCase=false negate=true /> </conditions> <action type=Rewrite url=index.PHP/{R:1} appendQueryString=true /> </rule> </rules> </rewrite> <handlers> <add name=php-cgi path=*.PHP verb=* modules=FastCgiModule scriptprocessor=D:\PHPStudy\PHP56n\php-cgi.exe resourceType=File /> </handlers> <defaultDocument> <files> <add value=index.PHP /> </files> </defaultDocument> </system.webServer> </configuration>
推荐学习:《PHP教程》
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。