2016-11-23 10 views
-1

私は2つのapache 2.4 serverAとserverBをいくつかの仮想ホストと一緒に使用しています。すべての着信要求はserverAに到着します。仮想ホストhttp&httpsを別の仮想ホストサーバにリダイレクト

特定の仮想ホスト名に対してhttpとhttps要求をserverAからserverBに転送するにはどうすればよいですか。

私のWAMPをサーバーAのセットアップは次のとおりです。 私のhostsファイルに127.0.0.7 example.com

バーチャルホスト:私のサーバBのIPは192.168.1.105と私のセットアップ仮想ホスト上の

<VirtualHost *:*> 
    ServerName  example.com 
    ProxyPreserveHost On 
    ProxyPass   "/" "http://192.168.1.105/" 
    ProxyPassReverse "/" "http://192.168.1.105/" 
</VirtualHost> 

ある

それと同じ名前のexample.com

私はhttp://example.comを使用するときに、私はhttp://localhost ようWAMPのホームページに滞在し、私はを使用する場合と私はバーチャルホストシンプルを追加サーバーAにサーバA

答えて

0

を、私は解決策を見つける:

<VirtualHost *:80> 
    ProxyPreserveHost On 
    ProxyPass   "/" "http://192.168.1.105/" 
    ProxyPassReverse "/" "http://192.168.1.105/" 
    ServerName  example.com 
</VirtualHost> 
<VirtualHost *:443> 
    SSLProxyEngine on 
    SSLCertificateFile "${APACHE_DIR}/conf/ssl_example.com/server.crt" 
    SSLCertificateKeyFile "${APACHE_DIR}/conf/ssl_example.com/server.key" 
    ErrorLog "logs/example.com-ssl_error.log" 
    CustomLog "logs/example.com-ssl_access.log" common 
    ProxyPreserveHost On 
    ProxyPass   "/" "https://192.168.1.105/" 
    ProxyPassReverse "/" "https://192.168.1.105/" 
    ServerName  example.com 
</VirtualHost> 
0

上のエラー403(禁止)を持っている:長い夜の後

Redirect/https://serverb.examample.com/ 
+0

おかげで、それはしていません作業! – Oli013

+0

これがうまくいかない場合は、これを正しい仮想ホストに追加していないか、この仮想ホストに到達していないか、他のリダイレクトやオーバーライドのように干渉していることがあります。 –

関連する問題