setting up laravel on IIS7

前端 未结 8 1873
别那么骄傲
别那么骄傲 2020-12-15 02:11

I want to set up my IIS7 server in order to let it works with a web application written in laravel (php framework).

I found something simil

相关标签:
8条回答
  • 2020-12-15 02:20

    I used the code below, redirect to index.php/{R:1} rather than public/{R:1} Works straight out of the box then with no path changes.

    <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>
    
    0 讨论(0)
  • 2020-12-15 02:25

    Check your Handler Mappings in IIS:

    1. launch IIS
    2. click on your site
    3. go on 'handler mappings' (in IIS block)
    4. Search for Path PHP, Name = PHPxx_via_FastCGI (xx = php version)
    5. Double click it, click on request restrictions and click on tab 'Verb's where you choose All verbs. This will fix it :-)
    0 讨论(0)
  • 2020-12-15 02:32

    Here is how I fixed it. open the config file, if the following mapping not exists, put these lines under

      <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 讨论(0)
  • 2020-12-15 02:34

    I created the web.config file in root folder inside <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>
    

    then copy the index.php file of the public folder into the root folder of the project modifying the ../paths.php into paths.php as this guide says

    now everything works perfectly

    0 讨论(0)
  • 2020-12-15 02:41

    Here is my working file, with two rules: (web site is pointing to public folder)

    <?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 讨论(0)
  • 2020-12-15 02:43

    Just got it working after long hours of google and testing. Here is my steps:

    laravel5 with IIS 8.5

    1. install window platform installer
    2. install php-5.6 with window platform installer
    3. install php-manager for IIS with window platform installer (optional)
    4. install Visual C++ Redistributable for Visual Studio 2012 (version x86)
      Without this, FastCgi process excited unexpected (php_info() will not works)
    5. install composer.exe
    6. export composer vendor bin path to path
      set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
    7. run composer global require "laravel/installer=~1.1"
    8. run lavarel new app
    9. create new application in IIS and point to <app>/public

    That's it, Happy Lavarel!

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

    0 讨论(0)
提交回复
热议问题