2016-06-17 7 views
0

cnameをポートにリダイレクトする必要があります。TeamCityの逆プロキシApache

Teamcityをサーバー(ポート8111)で実行していますが、teamcity.mydomain.comをmydomain.com:8111にリダイレクトするようにしたいとします。 Teamcityサーバーに入るにはteamcity.mydomain.comと入力するだけです。

私は、Apacheのリバースプロキシが私のためにやってくれることを読んだことがありますが、これまでのところ正しく設定できませんでした。

ps:mydomain.com:8111を実行すると動作します。

答えて

1

私はこのような何かが動作するはずだと思う:

ProxyPass/http://example.org:8111/ 
ProxyPassReverse/http://example.org:8111/ 
ProxyPreserveHost On 

のmod_proxyを有効にしていることを確認します。

0

Windowsで実行していてIISがインストールされている場合は、Application Request RoutingモジュールとRewriteモジュールをインストールしてIISでこれを実行できます。一度それをしたら、あなたのweb.configの書き換えルールはここにあります。これにより、http://example.comのすべての要求がhttp://example.com:8080に書き換えられます。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
    <rewrite> 
     <rules> 
      <rule name="CIReverseProxyInboundRule" stopProcessing="true"> 
       <match url="(.*)" /> 
       <action type="Rewrite" url="http://example.com:8080/{R:1}" /> 
       <conditions logicalGrouping="MatchAny"> 
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
       </conditions> 
      </rule> 
     </rules> 
     <outboundRules> 
      <rule name="CIReverseProxyOutboundRule" preCondition="ResponseIsHtml1"> 
       <match filterByTags="A, Form, Img" pattern="^http(s)?://example.com:8080/(.*)" /> 
       <action type="Rewrite" value="http{R:1}://example.com/{R:2}" /> 
      </rule> 
      <preConditions> 
       <preCondition name="ResponseIsHtml1"> 
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> 
       </preCondition> 
      </preConditions> 
     </outboundRules> 
    </rewrite> 
</system.webServer> 
</configuration> 
関連する問題