我想設置我的IIS7
服務器,以便它可以在laravel
(php框架)中編寫的Web應用程序中工作。在IIS7上設置laravel
我發現CI
(link)類似
,但它不laravel
工作(當然我刪除了index.php
重定向)。
實際上只有主頁作品(www.mysite.com/public
)
任何人使用/ d IIS7
與Laravel?
在此先感謝
我想設置我的IIS7
服務器,以便它可以在laravel
(php框架)中編寫的Web應用程序中工作。在IIS7上設置laravel
我發現CI
(link)類似
,但它不laravel
工作(當然我刪除了index.php
重定向)。
實際上只有主頁作品(www.mysite.com/public
)
任何人使用/ d IIS7
與Laravel?
在此先感謝
我創建的web.config
文件中的根文件夾內<configuration></configuration>
:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
</files>
</defaultDocument>
<handlers accessPolicy="Read, Execute, Script" />
<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="public/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
那麼index.php
文件的公用文件夾複製到項目修改../paths.php
到paths.php
的根文件夾作爲this指南說
現在一切正常
如果你希望能夠找回您的$ _GET變量不使用:
<match url="^(.*)$" ignoreCase="false" />
而是使用:
<match url="^" ignoreCase="false" />
檢查處理程序映射在IIS:
我用下面的代碼,重定向到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>
這是我的工作文件,有兩個規則:(網址指向公用文件夾)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteRequestsToPublic">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" url="/{R:0}" />
</rule>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
剛拿到它時間長谷歌和測試工作後。下面是我的步驟:
laravel5與IIS 8.5
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
composer global require "laravel/installer=~1.1"
lavarel new app
<app>/public
就是這樣,快樂Lavarel!
參考:http://alvarotrigo.com/blog/installing-laravel-4-in-windows-7-with-iis7/
這是我如何固定它。 打開配置文件,如果下面的映射不存在,把這些線
<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,轉到control panel -> uninstall programs
IIS
並按Turn Off Windows Features On/Off
鏈接並點擊IIS
,並選擇CGI
選項。
下載Web Platform Installer
來自互聯網install PHP and SQL drivers for IIS
開放IIS
從程序添加網站。並且公共文件夾點指向laravel/lumen項目中的Public
文件夾。
爲Laravel和流明項目。從任何可訪問文件夾中的作曲家創建項目。得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移動到根路徑。 – AskYous