Php 在IIS7上设置laravel
我想设置我的Php 在IIS7上设置laravel,php,mod-rewrite,iis-7,virtualhost,laravel,Php,Mod Rewrite,Iis 7,Virtualhost,Laravel,我想设置我的IIS7服务器,让它能够与用laravel(php框架)编写的web应用程序一起工作 我在CI() 但是它在laravel上不起作用(当然我删除了index.php重定向) 实际上,只有主页起作用(www.mysite.com/public) 有人在Laravel中使用/dIIS7 提前感谢我在内的根文件夹中创建了web.config文件: 导游说 现在一切都正常运行了如果您希望能够检索$\u GET变量,请不要使用: 而是使用: 检查IIS中的处理程序映射: 启动IIS 点击你
IIS7
服务器,让它能够与用laravel
(php框架)编写的web应用程序一起工作
我在CI
()
但是它在laravel
上不起作用(当然我删除了index.php
重定向)
实际上,只有主页起作用(www.mysite.com/public
)
有人在Laravel中使用/dIIS7
提前感谢我在
内的根文件夹中创建了web.config
文件:
导游说
现在一切都正常运行了如果您希望能够检索$\u GET变量,请不要使用:
而是使用:
检查IIS中的处理程序映射:
启动IIS
点击你的网站
继续“处理程序映射”(在IIS块中)
通过_FastCGI(xx=PHP版本)搜索路径PHP,Name=PHPxx_
双击它,单击请求限制,然后单击“动词”选项卡,从中选择所有动词。这将解决它:-)
我使用了下面的代码,重定向到index.php/{R:1}
而不是public/{R:1}
直接工作,然后没有路径更改
<rewrite>
<rules>
<rule name="Imported Rule 2" stopProcessing="true">
<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/{R:1}" />
</rule>
</rules>
</rewrite>
这是我的工作文件,有两条规则:(网站指向公用文件夹)
经过长时间的谷歌搜索和测试,它才开始工作。以下是我的步骤:
带有IIS 8.5的laravel5
安装
使用Windows平台安装程序安装php-5.6
使用Windows平台安装程序安装php manager for IIS(可选)
安装
如果没有这一点,FastCgi进程(php_info()将无法工作)
安装composer.exe
将编写器供应商bin路径导出到路径
设置路径=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
运行composer global require“laravel/installer=~1.1”
lavarel新应用程序
以下是我如何修复它的。
打开配置文件,如果以下映射不存在,请将这些行置于
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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" />
</rule>
</rules>
</rewrite>
要在windows上安装IIS
,请转到控制面板->卸载程序
,然后按关闭windows功能打开/关闭
链接,单击IIS
并选择CGI
选项
从internet下载Web平台安装程序
安装IIS的PHP和SQL驱动程序
从程序添加网站打开IIS。对于公用文件夹,指向laravel/lumen项目中的public
文件夹
用于Laravel和Lumen项目。在任何可访问的文件夹中从composer创建项目。进入文件夹结构中的public
文件夹并创建web.config
文件,其中包含以下内容我是从laracasts获得的
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
谢谢!为我工作!此外,我还必须将index.php移动到根路径。
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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" />
</rule>
</rules>
</rewrite>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>