日期:2014-05-17  浏览次数:20716 次

在apache上通过mod_ssl配置https


?1.编辑/usr/local/apache2/conf/httpd.conf

#Include conf/extra/httpd-ssl.conf 去掉#号或者最后添加一行

?

?2.编辑/usr/local/apache2/conf/extra/httpd-ssl.conf

?

?

?

添加
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

?

?

3.修改虚拟机路径:

<VirtualHost *:443>
#   General setup for the virtual host
DocumentRoot "/usr/local/www/test"
ServerName www.test.com:443
ServerAdmin test@test.com
ErrorLog "/var/log/httpd-error.log"
TransferLog "/var/log/httpd-access.log"

?
4.设置存放证书路径

?

?

SSLCertificateFile /usr/local/apache2/conf/ssl/public.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl/private.key
SSLCACertificateFile /usr/local/apache2/conf/ssl/verisign.crt

?

?

?

?

配置完毕后重启apache,通过netstat -ntlp? 查看443端口已经启用。
访问
https://xxxx.xxx.com 后却报404跳转到错误页面去了,经过查看apache,jboss日志后发现没有请求转发到后端jboss。

发现原来没有用mod_jk配置请求的转发。


5.在http-ssl.conf配置请求转发。
JkMount /*.* router 必须添加否则无法使apache与jboss(tomcat)转发请求。必须添加到<VirtualHost *:443>之后,

</VirtualHost>之前的位置。
就算在你的http.conf或者mod_jk.conf文件中已经配置JkMount /*.*router,也不会生效的,所以需要重新配置一下。

JkMount /channel/* worker1
JkMount /editor-admin/* worker2
JkMount /*.up worker2
JkMount /*.jsp worker2
JKMount /servlet/* worker2

?

?

?

?

?