2014-03-27 97 views
0

我有web應用程序部署在Tomacat8在Ubuntu 12.10,我可以訪問它@配置tomcat 8爲HTTPS

https://serverhostname:8443/myapp/代理支持。我已經通過編輯conf/server.xml配置了https,如下所示編輯conf/server.xml

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
      keystoreFile="/root/.keystore" keystorePass="xxxx" 
      maxThreads="150" scheme="https" secure="true" 
      clientAuth="false" sslProtocol="TLS" /> 

我希望它在https://serverhostname訪問端口80如何做到這一點的HTTPS。

所做的更改到目前爲止

安裝的Apache2

冉命令

a2enmod proxy 
a2enmod proxy_http 

加入/etc/init.d/apache2.conf線。

ProxyPass  /myapp https://serverhostname:8443/myapp 
ProxyPassReverse /myapp https://serverhostname:8443/myapp 

重新啓動apache2。

改變了連接器的conf/server.xml中

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
       keystoreFile="/root/.keystore" keystorePass="xxxx" 
       maxThreads="150" scheme="https" secure="true" 
       clientAuth="false" sslProtocol="TLS" 
       proxyName="https://serverhostname" proxyPort="80"/> 

但是,當我訪問https://serverhostname,我得到「網頁不可用」。

+0

了現在的工作。 –

回答

0

得到它現在在Ubuntu 12.10

工作

變化做

的/ etc/apache2的/網站可用/默認的SSL

<VirtualHost _default_:443> 

ServerAdmin [email protected] 
ServerName hostname.domain 
... 
... 
SSLEngine on 
SSLCertificateFile /etc/apache2/ssl/apache.crt 
SSLCertificateKeyFile /etc/apache2/ssl/apache.key 
SSLProxyEngine on 
ProxyRequests off 
<Proxy *> 
Order deny,allow 
Allow from all 
</Proxy> 

ProxyPass /myapp https://hostname.domain:8443/myapp 
ProxyPassReverse /mpapp https://hostname.domain:8443/myapp 

Redirect permanent/https://hostname.domain:8443/myapp 
... 

</VirtualHost> 

對始終使用https進行更改。

的/ etc/apache2的/網站可用/默認

<VirtualHost> 
.. 
... 
RewriteEngine on 
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L] 

</VirtualHost> 

變化做/tomcat/conf/server.xml

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
       keystoreFile="/root/.keystore" keystorePass="xxxx" 
       maxThreads="150" scheme="https" secure="true" 
       clientAuth="false" sslProtocol="TLS" 
       proxyName="https://hostname.domain" proxyPort="443"/>