h5ai icon indicating copy to clipboard operation
h5ai copied to clipboard

Can I config h5ai with IIS?

Open lowprofileusername opened this issue 7 years ago • 16 comments

If yes. any tuts? Thanks

I find nothing about h5ai with iis under windows.

Thanks

lowprofileusername avatar Apr 08 '17 02:04 lowprofileusername

Really simple: Example web root: C:\inetpub\wwwroot

Copy _h5ai folder to web root. You should have something like: C:\inetpub\wwwroot\_h5ai\public C:\inetpub\wwwroot\_h5ai\private with few other files. Add to "default documents" Name: _h5ai/public/index.php and move it to first place. It works out of a box with PHP enabled.

Armstrong1992 avatar Apr 27 '17 08:04 Armstrong1992

I have this working on IIS, but unfortunately sub-directories do not work. Behind the scenes, a POST request is failing with a 405

oranges13 avatar Nov 28 '17 19:11 oranges13

Do you have multiple handlers for POST/GET configured? It's often a reason for 405. And which version of a server?

Armstrong1992 avatar Nov 28 '17 20:11 Armstrong1992

It's pretty much the default configuration for PHP in IIS. I haven't customized any handlers for any verbs. And it's only an issue with subdirectories, it works in the root folder.

oranges13 avatar Nov 28 '17 20:11 oranges13

Add rewrite rule:

 <rewrite>
            <rules>
                <rule name="RewriteAll" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="_h5ai/public/index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>

Armstrong1992 avatar Nov 28 '17 20:11 Armstrong1992

In the subdirectory or the root?

oranges13 avatar Nov 28 '17 20:11 oranges13

Root Web.config

Armstrong1992 avatar Nov 28 '17 20:11 Armstrong1992

You did it! Thank you!

oranges13 avatar Nov 28 '17 21:11 oranges13

For some reason I cannot get it to work with subdirectories either yet the rewrite rule gives simply an error when I try to check the default document in IIS on the domain if I edit the web.config file. So it simply stays a 403. This is on IIS 10.

It does work on the folder h5ai is installed in.

Hakker avatar Feb 02 '18 14:02 Hakker

Weird, 403 looks like permissions problem. Directory browsing without h5ai works?

Armstrong1992 avatar Feb 04 '18 18:02 Armstrong1992

when I turn on directory browsing yes, but in h5ai the subdirs although seen in h5ai show nothing although it has files. If I go there directly I get the iis listing.

Also your web.config is partially incomplete I believe. it needs <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> aswell because without it I couldn't even see the subdirs and the rewrite module needs to be installed which isn't by new IIS installations.

Hakker avatar Feb 04 '18 22:02 Hakker

I would say that this is only part of the web.config file that you should add to web.config instead of replacing it. Right now i can't test it for IIS 10 to confirm yours problem. But I think this configuration should also work on this version of IIS smoothly.

<configuration>
    <system.webServer>
    Paste here
    ... Other config options ....
    </system.webServer>
</configuration>

Armstrong1992 avatar Feb 05 '18 08:02 Armstrong1992

tried it as follows added _h5ai/public/index.php to the default documents (as last) also tried /h5ai... and ~/h5ai... else it will take over normal index behaviour and you don't want that in most cases.

then my web.config looks like this

<configuration>
    <system.webServer>
        <directoryBrowse enabled="True" />
	<rewrite>
            <rules>
                <rule name="RewriteAll" 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="_h5ai/public/index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
	</system.webServer>
</configuration>

Hakker avatar Feb 05 '18 11:02 Hakker

Hello, I've got the issue with h5ai on IIS. The subdirectories show EMPTY, but there are files. image

image

c13ply avatar Jan 14 '21 14:01 c13ply

My web.config

<configuration>
    <system.webServer>
        <directoryBrowse enabled="True" />
	<rewrite>
            <rules>
                <rule name="RewriteAll" 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="_h5ai/public/index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
        <defaultDocument>
            <files>
                <add value="_h5ai/public/index.php" />
            </files>
        </defaultDocument>
        <staticContent>
            <mimeMap fileExtension="*" mimeType="application/octet-stream" />
        </staticContent>
	</system.webServer>
</configuration>

c13ply avatar Jan 14 '21 14:01 c13ply

Gente, eu resolvi esse problema depois de dias e trocando para xampp, entrei no site aqui https://ivampiresp.com/2020/01/16/iis%E4%B8%8B%E6%90%AD%E5%BB%BAh5ai%E6%96%B9%E6%B3%95%EF%BC%88%E5%8C%85%E6%8B%AC%E5%B8%B8%E8%A7%81%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9D%91%EF%BC%89.html site chinês mesmo!!

tem que ter instalado ->https://www.iis.net/downloads/microsoft/url-rewrite

image**

image

Web.config

<system.webServer>
    <directoryBrowse enabled="True" />
<rewrite>
        <rules>
            <rule name="RewriteAll" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Rewrite" url="_h5ai/public/index.php" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

jeffabner avatar Apr 11 '21 22:04 jeffabner