Created
December 17, 2013 14:04
-
-
Save grenade/8005368 to your computer and use it in GitHub Desktop.
All of the IIS configuration required to host TeamCity, Stash and NuGetGallery on a single IIS server using IIS web farm and rewrite rules to route hostnames:80 to TomCat sites on their default ports.
The file normally lives at: c:\windows\system32\inetsrv\config\applicationhost.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <configuration> | |
| <!-- | |
| ... | |
| --> | |
| <system.applicationHost> | |
| <applicationPools> | |
| <add name="DefaultAppPool" /> | |
| <add name="Classic .NET AppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" /> | |
| <add name=".NET v2.0 Classic" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" /> | |
| <add name=".NET v2.0" managedRuntimeVersion="v2.0" /> | |
| <add name=".NET v4.5 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" /> | |
| <add name=".NET v4.5" managedRuntimeVersion="v4.0" /> | |
| <add name="nuget.some-domain.com" managedRuntimeVersion="v4.0" /> | |
| <add name="teamcity.some-domain.com"> | |
| <processModel identityType="SpecificUser" userName="some-domain\svc_teamcity" password="[enc:IISWASOnlyAesProvider:...=:enc]" /> | |
| </add> | |
| <add name="stash.some-domain.com"> | |
| <processModel identityType="SpecificUser" userName="some-domain\svc_stash" password="[enc:IISWASOnlyAesProvider:...=:enc]" /> | |
| </add> | |
| <applicationPoolDefaults managedRuntimeVersion="v4.0"> | |
| <processModel identityType="ApplicationPoolIdentity" /> | |
| </applicationPoolDefaults> | |
| </applicationPools> | |
| <customMetadata /> | |
| <listenerAdapters> | |
| <add name="http" /> | |
| </listenerAdapters> | |
| <log> | |
| <centralBinaryLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" /> | |
| <centralW3CLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" /> | |
| </log> | |
| <sites> | |
| <site name="nuget.some-domain.com" id="1" serverAutoStart="true"> | |
| <application path="/" applicationPool="nuget.some-domain.com"> | |
| <virtualDirectory path="/" physicalPath="D:\inetpub\nuget.some-domain.com" /> | |
| </application> | |
| <bindings> | |
| <binding protocol="http" bindingInformation="*:80:nuget.some-domain.com" /> | |
| </bindings> | |
| </site> | |
| <site name="teamcity.some-domain.com" id="2" serverAutoStart="true"> | |
| <application path="/" applicationPool="teamcity.some-domain.com"> | |
| <virtualDirectory path="/" physicalPath="d:\inetpub" /> | |
| </application> | |
| <bindings> | |
| <binding protocol="http" bindingInformation="*:80:teamcity.some-domain.com" /> | |
| </bindings> | |
| </site> | |
| <site name="teamcity" id="3" serverAutoStart="true"> | |
| <application path="/" applicationPool="teamcity.some-domain.com"> | |
| <virtualDirectory path="/" physicalPath="d:\inetpub" /> | |
| </application> | |
| <bindings> | |
| <binding protocol="http" bindingInformation="*:80:teamcity" /> | |
| </bindings> | |
| </site> | |
| <site name="stash.some-domain.com" id="4" serverAutoStart="true"> | |
| <application path="/" applicationPool="teamcity.some-domain.com"> | |
| <virtualDirectory path="/" physicalPath="d:\inetpub" /> | |
| </application> | |
| <bindings> | |
| <binding protocol="http" bindingInformation="*:80:stash.some-domain.com" /> | |
| </bindings> | |
| </site> | |
| <site name="stash" id="5"> | |
| <application path="/" applicationPool="teamcity.some-domain.com"> | |
| <virtualDirectory path="/" physicalPath="d:\inetpub" /> | |
| </application> | |
| <bindings> | |
| <binding protocol="http" bindingInformation="*:80:stash" /> | |
| </bindings> | |
| </site> | |
| <siteDefaults> | |
| <logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" /> | |
| <traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" /> | |
| </siteDefaults> | |
| <applicationDefaults applicationPool="DefaultAppPool" /> | |
| <virtualDirectoryDefaults allowSubDirConfig="true" /> | |
| </sites> | |
| <webLimits /> | |
| </system.applicationHost> | |
| <system.webServer> | |
| <!-- | |
| ... | |
| --> | |
| <rewrite> | |
| <globalRules> | |
| <rule name="ARR_TeamCity_loadbalance" patternSyntax="Wildcard" stopProcessing="true"> | |
| <match url="*" /> | |
| <action type="Rewrite" url="http://TeamCity/{R:0}" /> | |
| <conditions logicalGrouping="MatchAny"> | |
| <add input="{HTTP_HOST}" pattern="teamcity.some-domain.com" /> | |
| <add input="{HTTP_HOST}" pattern="teamcity" /> | |
| </conditions> | |
| </rule> | |
| <rule name="ARR_Stash_loadbalance" patternSyntax="Wildcard" stopProcessing="true"> | |
| <match url="*" /> | |
| <action type="Rewrite" url="http://Stash/{R:0}" /> | |
| <conditions logicalGrouping="MatchAny"> | |
| <add input="{HTTP_HOST}" pattern="stash.some-domain.com" /> | |
| <add input="{HTTP_HOST}" pattern="stash" /> | |
| </conditions> | |
| </rule> | |
| </globalRules> | |
| <outboundRules> | |
| <preConditions> | |
| <preCondition name="ResponseIsHtml1"> | |
| <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> | |
| </preCondition> | |
| </preConditions> | |
| </outboundRules> | |
| </rewrite> | |
| </system.webServer> | |
| <webFarms> | |
| <webFarm name="TeamCity" enabled="true" adminUserName="" adminPassword="[enc:AesProvider:...=:enc]"> | |
| <server address="teamcity-hostname.some-domain.com" enabled="true"> | |
| <applicationRequestRouting httpPort="8111" /> | |
| </server> | |
| <applicationRequestRouting> | |
| <loadBalancing algorithm="WeightedRoundRobin" /> | |
| <protocol reverseRewriteHostInResponseHeaders="true" /> | |
| </applicationRequestRouting> | |
| </webFarm> | |
| <webFarm name="Stash" enabled="true" adminUserName="" adminPassword="[enc:AesProvider:...=:enc]"> | |
| <server address="stash-hostname.some-domain.com" enabled="true"> | |
| <applicationRequestRouting httpPort="7990" /> | |
| </server> | |
| <applicationRequestRouting> | |
| <loadBalancing algorithm="WeightedRoundRobin" /> | |
| <protocol reverseRewriteHostInResponseHeaders="true" /> | |
| </applicationRequestRouting> | |
| </webFarm> | |
| <applicationRequestRouting> | |
| <hostAffinityProviderList> | |
| <add name="Microsoft.Web.Arr.HostNameRoundRobin" /> | |
| <add name="Microsoft.Web.Arr.HostNameMemory" /> | |
| </hostAffinityProviderList> | |
| </applicationRequestRouting> | |
| </webFarms> | |
| <!-- | |
| ... | |
| --> | |
| </configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment