2013-01-17 94 views
4

我想設置我的IIS7服務器,以便它可以在laravel(php框架)中編寫的Web應用程序中工作。在IIS7上設置laravel

我發現CIlink)類似

,但它不laravel工作(當然我刪除了index.php重定向)。

實際上只有主頁作品(www.mysite.com/public

任何人使用/ d IIS7與Laravel?

在此先感謝

回答

6

我創建的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.phppaths.php的根文件夾作爲this指南說

現在一切正常

0

如果你希望能夠找回您的$ _GET變量不使用:

<match url="^(.*)$" ignoreCase="false" />

而是使用:

<match url="^" ignoreCase="false" />

3

檢查處理程序映射在IIS:

  1. 啓動IIS
  2. 點擊網站上的
  3. 去「處理程序映射」(在IIS塊)
  4. 搜索路徑PHP,名稱= PHPxx_via_FastCGI(XX = PHP版本)
  5. 雙擊它,點擊請求限制和點擊標籤'動詞,你選擇所有動詞。這將修復它:-)
4

我用下面的代碼,重定向到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> 
3

這是我的工作文件,有兩個規則:(網址指向公用文件夾)

<?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> 
+0

謝謝!爲我工作!另外,我必須將index.php移動到根路徑。 – AskYous

2

剛拿到它時間長谷歌和測試工作後。下面是我的步驟:

laravel5與IIS 8.5

  1. 安裝window platform installer
  2. 安裝PHP-5。6窗口平臺安裝
  3. 安裝PHP-經理IIS與窗口平臺安裝程序(可選)
  4. 安裝Visual C++ Redistributable for Visual Studio 2012 (version x86)
    沒有這一點,FastCGI進程興奮意外(php_info()將無法工作)
  5. 安裝composer.exe
  6. 出口作曲家廠商倉路徑路徑
    set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
  7. 運行composer global require "laravel/installer=~1.1"
  8. 運行lavarel new app
  9. 在IIS中創建和點新的應用程序,以<app>/public

就是這樣,快樂Lavarel!

參考:http://alvarotrigo.com/blog/installing-laravel-4-in-windows-7-with-iis7/

0

這是我如何固定它。 打開配置文件,如果下面的映射不存在,把這些線

<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> 
0

下安裝在您的Windows,轉到control panel -> uninstall programsIIS並按Turn Off Windows Features On/Off鏈接並點擊IIS,並選擇CGI選項。

enter image description here

下載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>