Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 8 does not recognized web.config

Tags:

php

iis

I have run multiple PHP (Laravel) applications on my IIS 8 (Win 2012) Server. This is the web.config file for all of my apps:

<configuration>
  <system.webServer>
    <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>
  </system.webServer>
</configuration>

But on one appliation, IIS make from time to time a problem: My app don't work, because the URLs are wrong. If i restart the Webserver OR change the web.config file (add a empty space or something...), it works again.

I have no idea...my other apps works without problems, and it's the same web.config code.

All Users (IIS_IUSR, Admins, etc) have full write and read access.

My apps are structured in folders, see here:

enter image description here enter image description here

And i call it with 10.0.0.7/doku or 10.0.0.7/lagerverwaltung.

like image 702
nutzt Avatar asked May 19 '17 06:05

nutzt


1 Answers

When using IIS I would consider converting each of the specific site folders (doku, lagerverwaltung, etc.) into their own application. That way there will be no confusion over which web.config file is being used when loading and further the apps could then run inside their own app pool and threads.

To do this, inside IIS right click on the specific folder you wish to convert and click on "Convert to Application" in the context menu which opens up. In the subsequent screen you can choose an existing or new Application Pool and also setup any required pass-through authentication you may need.

Forcing the sub-sites to run inside their own application pool and use their own web.config file specifically should eliminate your issue with potential fallback to a base web.config.

like image 52
Matthew Fritz Avatar answered Oct 18 '22 08:10

Matthew Fritz