Skip to content

Installation on IIS with Tomcat

SolusAU edited this page Nov 6, 2017 · 17 revisions

Tomcat 8.5 can be used to host GitBucket versions above 3.10 (Java 8)

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0]
  • Create file C:\tomcat8\conf\
worker.list = worker1
  • Create file C:\tomcat8\conf\
  • Configure IIS

    • Configure IIS server properties ISAPI and CGI Restrictions. Add Path C:\tomcat8\bin\isapi_redirect.dll with description Tomcat Isapi Redirect.
    • Create VirtualDirectory - MUST be named jakarta and point to C:\tomcat8\bin
    • Withjakarta VirtualDirectory selected open Handler Mappings and choose Edit Feature Permissions. Make sure Read, Script, and Execute permissions are checked.
    • Add ISAPI filter to IIS website configuration. Filter Name: jakarta, Executable: C:\tomcat8\bin\isapi_redirect.dll
    • The used IIS Application Pool should have Enable 32-bit Applications set to False
    • Under Request Filtering for the parent website hosting the jakarta VirtualDirectory. Remove request filters for *.java, *.cs and *.vb. If you do not remove these filters then files viewed in gitbucket with these extensions will give a 404 error. You may wish to remove additional filters too such as .csproj.
  • place gitbucket.war in C:\tomcat8\webapps

  • Configure system environment variables for GITBUCKET_HOME=D:\gitbucket_data and GITBUCKET_LOG_DIR=D:\gitbucket_data\logs

  • At this point gitbucket should be available from both http://localhost/gitbucket (via IIS) and http://localhost:8080/gitbucket (direct connect to Tomcat)

If you have trouble with this configuration refer to Configure IIS 8 and Tomcat Connector ISAPI Filter on Windows Server 2012

Helicontech Zoo, can be used to host GitBucket versions 3.10 and below (Java 7).

Using Helicontech Zoo we can deploy GitBucket as a java servlet on IIS

  • Use GitBucket versions 3.10 and below, higher versions require Java 8
  • Install Java 7
  • Follow these instructions to install the Helicontech Zoo Java hosting package
  • Configure your gitbucket IIS application folder (ex: C:\inetpub\wwwroot\gitbucket)
    • add gitbucket.war to C:\inetpub\wwwroot\gitbucket\
    • add web.config to C:\inetpub\wwwroot\gitbucket\
      • verify JDK_HOME and JAVA_HOME paths in web.config
    • configure IIS_IUSRS to have write permissions to C:\inetpub\wwwroot\gitbucket\

Contents of web.config, assuming you want to install to http://hostname/gitbucket

<?xml version="1.0" encoding="UTF-8"?>
            <clear />
            <application name="gitbucket">
                    <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" />
                    <add name="WAR_FILE" value="gitbucket.war" />
                    <add name="JDK_HOME" value="C:\Program Files\Java\jdk1.7.0_40" />
                    <add name="JAVA_HOME" value="C:\Program Files\Java\jdk1.7.0_40" />
                    <add name="GITBUCKET_HOME" value="C:\gitbucket_data" />
                    <add name="CONTEXT_PATH" value="/gitbucket" />
            <add name="gitbucket#x64" path="*" verb="*" modules="HeliconZoo_x64" scriptProcessor="java.jetty.8" resourceType="Unspecified" requireAccess="Script" preCondition="bitness64" />
            <add name="gitbucket#x86" path="*" verb="*" modules="HeliconZoo_x86" scriptProcessor="java.jetty.8" resourceType="Unspecified" requireAccess="Script" preCondition="bitness32" />
                    <remove fileExtension=".ldb" />
                    <remove fileExtension=".refresh" />
                    <remove fileExtension=".webinfo" />
                    <remove fileExtension=".vjsproj" />
                    <remove fileExtension=".vbproj" />
                    <remove fileExtension=".vb" />
                    <remove fileExtension=".resx" />
                    <remove fileExtension=".resources" />
                    <remove fileExtension=".mdf" />
                    <remove fileExtension=".mdb" />
                    <remove fileExtension=".master" />
                    <remove fileExtension=".exclude" />
                    <remove fileExtension=".java" />
                    <remove fileExtension=".csproj" />
                    <remove fileExtension=".config" />
                    <remove fileExtension=".ascx" />
                    <remove fileExtension=".asax" />
                    <remove fileExtension=".cs" />
                    <remove segment="App_Browsers" />
                    <remove segment="App_WebReferences" />
                    <remove segment="App_LocalResources" />
                    <remove segment="App_GlobalResources" />
                    <remove segment="App_Data" />
                    <remove segment="App_code" />
                    <remove segment="web.config" />

In the above configuration, some file extensions are removed from request filtering because when running under IIS certain file extensions such as "java", "cs","vb", "csproj","vbproj","ascx", and "asax" will not be viewable in the repository and by default you will get a 404 error.


Tomcat with IIS

It should be noted that the docs for Tomcat with IIS, says the following:

Note that in a 64 Bit environment - at least for IIS 7 - the used IIS Application Pool should have "Enable 32-bit Applications" set to "False". Otherwise the redirector will not be called and returns an http code 404. If you think, the 32bit version of isapi_redirect.dll would do the job instead, you will get an http code 500, because the library is not loadable into a 64 Bit IIS.

This is a problem that may or may not apply to the Helicontech Zoo, Jetty 8, setup that we use for this GitBucket installation or not (I have not thoroughly checked and do not know if this uses the same tech or not). But if you attach GitBucket to its own IIS Application Pool with "Enable 32-bit Applications" set to "False" then GitBucket does work using Helicontech Zoo and Jetty 8.

Maximum Allowed Content Length

Under a server of Windows + IIS environment, if you are not able to push large files (normally larger than 30,000,000 bytes) from any client, it could be that IIS is rejecting your requests. In this case, you can raise the Maximum allowed content length value as explained in this documentation.

Note: this could happen even if you are not using Helicontech Zoo or Tomcat as introduced above; a standalone app could also be interfered by IIS.

You can’t perform that action at this time.