2015-12-30 77 views
0

所以我最終得到了我的域名重定向工作。將domain.com/path重定向到另一臺Apache服務器

我目前有3個Apache VM。一個是「網絡服務器」其他有實際的網站和其他主機zoneminder

如果您訪問的domain.com你的網站,並可以瀏覽左右,但...

如果我手動型domain.com/zm試圖訪問zoneminder

它redirecets domain.com/zm在我的遠程瀏覽器http://192.168.1.42:443/media

我環顧四周,但民族問題似乎無論是複雜或不夠複雜。

CONFIGS:

網絡服務器(Apache的):

<VirtualHost *:80> 
    ServerName  www.domain.com 
    RedirectPermanent/http://domain.com 
</VirtualHost> 

<VirtualHost *:80> 
ServerName domain.com 
ProxyRequests Off 
<Proxy *> 
    Order deny,allow 
    Allow from all 
</Proxy> 

ProxyPass/http://192.168.1.42:80/ 
ProxyPassReverse/http://192.168.1.42:80/ 
<Location /> 
    Order allow,deny 
    Allow from all 
</Location> 
</VirtualHost> 

網站(阿帕奇):

<VirtualHost *:80> 
ServerName domain.com 
DocumentRoot /var/www/html 
LogLevel warn 
ErrorLog ${APACHE_LOG_DIR}/fishingparty.log 
CustomLog ${APACHE_LOG_DIR}/fishingparty-access.log combined 
</VirtualHost> 

回答

0

得到它的工作!

的設置:

服務器A)Apache服務器只有供應的ProxyPass,不保留任何

服務器B)Apache服務器託管主domain.com

服務器C)Apache服務器萬軍ZoneMinder @ domain.com/zm

服務器A配置:

<VirtualHost *:80> 
ServerName domain.com 
Redirect/https://www.domain.com/ 
</VirtualHost> 

<VirtualHost *:443> 
ServerName www.domain.com 
ProxyRequests Off 
<Proxy *> 
    Order deny,allow 
    Allow from all 
</Proxy> 
SSLProxyEngine On 
SSLProxyCheckPeerCN on 
SSLProxyCheckPeerExpire on 
SSLEngine on 
SSLCertificateFile /location of .crt 
SSLCertificateKeyFile /location of .key 
SSLCACertificateFile /location of .crt 
ProxyPreserveHost on 

ProxyPass /zm https://192.168.1.43:443/zm 
ProxyPassReverse /zm https://192.168.1.43:443/zm 


ProxyPass/https://192.168.1.42:443/ 
ProxyPassReverse/https://192.168.1.42:443/ 

<Location /> 
    Order allow,deny 
    Allow from all 
</Location> 
</VirtualHost> 

注意:在/「/」出現在「/」之前很重要。如果我使用/ zm /,我也注意到它失敗了。

服務器B配置:

<VirtualHost *:443> 
ServerName www.domain.com 
DocumentRoot /var/www/html 
LogLevel warn 
ErrorLog ${APACHE_LOG_DIR}/domain.log 
CustomLog ${APACHE_LOG_DIR}/domain.log combined 
SSLEngine on 
SSLCertificateFile /location of .crt 
SSLCertificateKeyFile /location of .key 
SSLCACertificateFile /location of .crt 
</VirtualHost> 

注:這是沒有必要有*:80個重定向或服務器別名,因爲只有正確格式的請求通過的ProxyPass過濾事先發送到該服務器。

服務器C配置:(domain.com/zm)

<VirtualHost *:443> 
ServerName www.domain.com 
DocumentRoot /var/www/html 
LogLevel warn 
ErrorLog ${APACHE_LOG_DIR}/domain.log 
CustomLog ${APACHE_LOG_DIR}/domain.log combined 
SSLEngine on 
SSLCertificateFile /location of .crt 
SSLCertificateKeyFile /location of .key 
SSLCACertificateFile /location of .crt 
</VirtualHost> 

是的,它是一樣的。它工作,所以我很高興!

注意:所有3臺服務器都安裝了我的SSL證書,但我沒有碰到default-ssl.conf。

相關問題