Apache SSLProxyEngine

我必须configuration一个反向代理redirectHTTP请求到另一个也运行HTTPs的主机,,,但我卡住了

这里是我的Apache上的虚拟主机configuration作为反向代理

<VirtualHost *:80> ServerAdmin [email protected] ServerName mail.mydomain.com RewriteEngine on RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] SSLProxyEngine on <Proxy "*"> Order allow,deny Allow from all </Proxy> ProxyPass / https://192.168.1.6/webmail/ ProxyPassReverse / https://192.168.1.6/webmail/ ErrorLog /var/log/apache2/webmail_log CustomLog /var/log/apache2/webmail-access_log combined </VirtualHost> 

在我的浏览器上,我使用这个地址http://mail.mydomain.com

但它只是将请求redirect到反向代理服务器上的HTTP而不是邮件主机上的HTTP。

谢谢你们

我还没有build立一个https反向代理,但我现在要做

据我可以告诉你的代理定义是在错误的地方。

您的RewriteRule将您从http虚拟主机redirect到您的https虚拟主机,因此代理configuration必须去的地方。

编辑:基本上我的意思是这样的:

从端口80上的虚拟主机中删除代理

 <VirtualHost *:80> ServerAdmin [email protected] ServerName mail.mydomain.com RewriteEngine on RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] ErrorLog /var/log/apache2/webmail_log CustomLog /var/log/apache2/webmail-access_log combined </VirtualHost> 

并将其添加到侦听端口443(https)的虚拟主机上

 <VirtualHost *:443> 

…其他虚拟主机configuration….

  SSLProxyEngine on <Proxy "*"> Order allow,deny Allow from all </Proxy> ProxyPass / https://192.168.1.6/webmail/ ProxyPassReverse / https://192.168.1.6/webmail/ </VirtualHost> 

我没有testing这个确切的设置,但我认为它应该像这样工作…