New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for IIS7 #1265

Closed
dzuelke opened this Issue Apr 19, 2010 · 8 comments

Comments

Projects
None yet
1 participant
@dzuelke
Contributor

dzuelke commented Apr 19, 2010

http://www.iis.net/expand/urlrewrite is the new URL Rewrite module (pretty nice actually).

Some of the usual encoding woes though (REQUEST_URI already decoded, for instance).

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Apr 19, 2010

Contributor

(In 064084c) from 5523393 to 39d1795 (from david-azure): ext/sqlsrv database adapter, closes #1264; IIS7 support, closes #1265; AgaviWindowsazureSessionStorage, closes #1266

Contributor

dzuelke commented Apr 19, 2010

(In 064084c) from 5523393 to 39d1795 (from david-azure): ext/sqlsrv database adapter, closes #1264; IIS7 support, closes #1265; AgaviWindowsazureSessionStorage, closes #1266

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Apr 19, 2010

Contributor

Issue closed

Contributor

dzuelke commented Apr 19, 2010

Issue closed

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Apr 19, 2010

Contributor

(In cd58733dd7566f2341570e0ec6578fc45fa042fb) IIS7 with URL Rewrite Module rules, refs #1265

Contributor

dzuelke commented Apr 19, 2010

(In cd58733dd7566f2341570e0ec6578fc45fa042fb) IIS7 with URL Rewrite Module rules, refs #1265

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Apr 19, 2010

Contributor

(In 194f14803674851ca4d1accef7e5fb2bcaf3a733) IIS7 with URL Rewrite Module rules, take two, refs #1265

Contributor

dzuelke commented Apr 19, 2010

(In 194f14803674851ca4d1accef7e5fb2bcaf3a733) IIS7 with URL Rewrite Module rules, take two, refs #1265

@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 8, 2010

Contributor

Sample web.config for / (if you're using a sub-folder, omit the leading slash, e.g. path/to/folder/ if your site resides in http://localhost/path/to/folder/):

<configuration>
    <system.webServer> 
        <security>
            <requestFiltering allowDoubleEscaping="true" />
        </security>
        <rewrite>
            <rules>
                <rule name="Agavi Dispatcher for /" stopProcessing="true">
                    <match url="^$" />
                    <action type="Rewrite" url="index.php?/" />
                </rule>
                <rule name="Agavi Dispatcher" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
Contributor

dzuelke commented Aug 8, 2010

Sample web.config for / (if you're using a sub-folder, omit the leading slash, e.g. path/to/folder/ if your site resides in http://localhost/path/to/folder/):

<configuration>
    <system.webServer> 
        <security>
            <requestFiltering allowDoubleEscaping="true" />
        </security>
        <rewrite>
            <rules>
                <rule name="Agavi Dispatcher for /" stopProcessing="true">
                    <match url="^$" />
                    <action type="Rewrite" url="index.php?/" />
                </rule>
                <rule name="Agavi Dispatcher" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 8, 2010

Contributor

Sample web.config for running on Windows Azure (needs to be in the root of your Project_WebRole folder), rewriting to the pub/ subdirectory which cannot be made document root on Azure:

<configuration>
    <system.webServer>
        <!-- DO NOT REMOVE: PHP FastCGI Module Handler -->
        <handlers>
            <clear/>
            <add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="%RoleRoot%\approot\php\php-cgi.exe" resourceType="Unspecified"/>
            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read"/>
        </handlers>
        <!-- Example WebRole IIS 7 Configuration -->
        <defaultDocument>
            <files>
                <clear/>
                <add value="index.php"/>
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="pub/ access only">
                    <match url="(.*)"/>
                    <action type="Rewrite" url="/pub/{R:1}"/>
                </rule>
                <rule name="Agavi Dispatcher for /" stopProcessing="true">
                    <match url="^/pub/$"/>
                    <action type="Rewrite" url="/pub/index.php?/"/>
                </rule>
                <rule name="Agavi Dispatcher" stopProcessing="true">
                    <match url="^/pub/(.*)$"/>
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                    </conditions>
                    <action type="Rewrite" url="/pub/index.php?/{R:1}"/>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
Contributor

dzuelke commented Aug 8, 2010

Sample web.config for running on Windows Azure (needs to be in the root of your Project_WebRole folder), rewriting to the pub/ subdirectory which cannot be made document root on Azure:

<configuration>
    <system.webServer>
        <!-- DO NOT REMOVE: PHP FastCGI Module Handler -->
        <handlers>
            <clear/>
            <add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="%RoleRoot%\approot\php\php-cgi.exe" resourceType="Unspecified"/>
            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read"/>
        </handlers>
        <!-- Example WebRole IIS 7 Configuration -->
        <defaultDocument>
            <files>
                <clear/>
                <add value="index.php"/>
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="pub/ access only">
                    <match url="(.*)"/>
                    <action type="Rewrite" url="/pub/{R:1}"/>
                </rule>
                <rule name="Agavi Dispatcher for /" stopProcessing="true">
                    <match url="^/pub/$"/>
                    <action type="Rewrite" url="/pub/index.php?/"/>
                </rule>
                <rule name="Agavi Dispatcher" stopProcessing="true">
                    <match url="^/pub/(.*)$"/>
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                    </conditions>
                    <action type="Rewrite" url="/pub/index.php?/{R:1}"/>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 8, 2010

Contributor

You also need to statically configure server ports (and, at least in production, server names) since the Azure load balancer does not pass them through correctly:

<ae:configuration environment="development-david" context="web">
    <request class="AgaviWebRequest">
        <ae:parameter name="sources">
            <!-- assuming you are running on port 81 since the default IIS web site is on port 80 -->
            <!-- if you need a hostname other than "localhost", configure it using "SERVER_NAME" -->
            <ae:parameter name="SERVER_PORT">81</ae:parameter>
        </ae:parameter>
    </request>
</ae:configuration>
<ae:configuration environment="production" context="web">
    <request class="AgaviWebRequest">
        <ae:parameter name="sources">
            <ae:parameter name="SERVER_NAME">www.servername.com</ae:parameter>
            <ae:parameter name="SERVER_PORT">80</ae:parameter>
        </ae:parameter>
    </request>
</ae:configuration>
Contributor

dzuelke commented Aug 8, 2010

You also need to statically configure server ports (and, at least in production, server names) since the Azure load balancer does not pass them through correctly:

<ae:configuration environment="development-david" context="web">
    <request class="AgaviWebRequest">
        <ae:parameter name="sources">
            <!-- assuming you are running on port 81 since the default IIS web site is on port 80 -->
            <!-- if you need a hostname other than "localhost", configure it using "SERVER_NAME" -->
            <ae:parameter name="SERVER_PORT">81</ae:parameter>
        </ae:parameter>
    </request>
</ae:configuration>
<ae:configuration environment="production" context="web">
    <request class="AgaviWebRequest">
        <ae:parameter name="sources">
            <ae:parameter name="SERVER_NAME">www.servername.com</ae:parameter>
            <ae:parameter name="SERVER_PORT">80</ae:parameter>
        </ae:parameter>
    </request>
</ae:configuration>
@dzuelke

This comment has been minimized.

Show comment
Hide comment
@dzuelke

dzuelke Aug 8, 2010

Contributor

(In 6abe517) IIS7 rewrite readme, refs #1265

Contributor

dzuelke commented Aug 8, 2010

(In 6abe517) IIS7 rewrite readme, refs #1265

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment