2016-06-14 117 views
0

我們在我們的應用程序中使用apache tomcat 7.0。我們需要配置SSL,但我想在httpd apache上安裝ssl加密和解密。所以有可能有這樣的配置?Apache SSL配置

回答

0

是的,您可以使用mod_proxy_http將HTTPS請求代理回HTTP請求到Apache Tomcat服務器。

所以,如果你想送達的所有流量通過HTTPS做到以下幾點:

確保Tomcat正在端口8080上運行(而不是80),安裝的Apache2的httpd,然後:

a2enmod proxy 
a2enmod proxy_http 
a2enmod ssl 
a2enmod rewrite 

創建一個名爲mysite.conf具有以下VirtualHost指令文件:

<VirtualHost *:443> 
    ServerName www.yourdomainname.com 
    SSLEngine on 
    SSLCertificateFile "/path/to/www.yourdomainname.com.cert" 
    SSLCertificateKeyFile "/path/to/www.yourdomainname.com.key" 
    ProxyPreserveHost On 
    ProxyPassReverse/http://localhost:8080/ 
</VirtualHost> 

<VirtualHost *:80> 
    ServerName www.yourdomainname.com 
    RewriteEngine On 
    RewriteCond %{HTTPS} off 
    RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302] 
</VirtualHost> 

最後

a2ensite mysite