我正在使用ProxyPass和ProxyPassReverse指令将来自Tomcat应用程序(从端口8080)的所有请求redirect到子域(端口80)。 另外我有80端口的默认PHP网站。所以configuration如下所示:
<VirtualHost xx.xx.xx.xx:80 > ServerName domain.com DocumentRoot /var/www/site </VirtualHost> <VirtualHost xx.xx.xx.xx:80 > ServerName sub.domain.com ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
现在,我必须添加一个SSL支持,所以我添加了以下行到configuration:
NameVirtualHost *:443 <VirtualHost _default_:443> SSLEngine on SSLCertificateFile /usr/local/ssl/crt/public.crt SSLCertificateKeyFile /usr/local/ssl/private/private.key SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt ServerName domain.com:443 DocumentRoot /var/www/site </VirtualHost>
但问题是https只能在根站点上正常工作,但是当我试图通过https获取子域名时,它会将我redirect到不存在的页面…如何configurationapache以实现此目的?
谢谢
您尚未为sub.domain.com添加SSL(端口443)virtualHost,例如
<VirtualHost _default_:443> ServerName sub.domain.com SSLEngine On SSLCertificateFile /usr/local/ssl/crt/public.crt SSLCertificateKeyFile /usr/local/ssl/private/private.key SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> # Needed if you want to go to preserve the SSL connection all the way to tomcat, # but not worth it as both daemons are on the same physical box. #SSLProxyEngine On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>