实例讲解apache+tomcat+ssl配置
我的运行环境:windows2003 server sp4 + j2sdk1.5.0 + apache2.0.54 + tomcat5.5.9
**准备软件:
1、安装 apache 2.0.54
2、tomcat 5.5.14
3、jk2连接器(mod_jk2.so)
一:配置apache和tomcat
apache安装在d:\apache2 下,监听端口 80;
tomcat在d:\tomcat51 下,监听端口 8080;
两者都以windows 2000服务进行安装。
将mod_jk2.so复制到d:\apache2\modules目录下:
1.编辑d:\apache2\conf\httpd.conf文件,在loadmodule那一段代码中添加:
loadmodule jk2_module modules/mod_jk2.so
2.将adddefaultcharset iso-8859-1 改为 adddefaultcharset gb2312 使apache自动支持中文显示;
3.在“虚拟主机配置代码段”中添加:(此段配置可以根据你的实际情况进行修改)
<virtualhost *:80>
serveradmin linvsfen◎163.com
documentroot "d:/ tomcat51/webapps/jsp-examples
servername localhost
errorlog logs/error_log
customlog logs/access_log common
</virtualhost>
**编写workers2.properties文件并加入d:\apache2\conf目录,内容如下:
# usually commented out on production environments
file=”d:/apache2/logs/error.log”
level=error
# provide the basic config needed
file=d:/apache2/conf/workers2.properties
debug=1
# provide the location of shm file on the apache web server
file=d:/apache2/conf/jk2.shm
size=1000000
port=8009
host=localhost
#define the worker
channel=channel.socket:localhost:8009
# map the tomcat examples webapp to the web server uri space
**编写一个jsp文件(sessiontest.jsp),放在d:\tomcat51\webapps\jsp-examples 下;
重新启动以后,启动apache和tomcat,访问http://localhost/jsp-examples/sessiontest.jsp可以访问。
二.tomcat配置上ssl步骤:
1. 生成服务器证书server02.jks和客户端证书dwp.p12
2、把server02.jks放到conf目录下,
打开d:\ tomcat51\conf\server.xml 文件,
然后修改server.xml文件,将注释掉的内容的注释去掉和增加证书存放的位置:如下:
<connector port="8443" maxhttpheadersize="8192"
maxthreads="150" minsparethreads="25" maxsparethreads="75"
enablelookups="false" disableuploadtimeout="true"
acceptcount="100" scheme="https" secure="true"
clientauth="true" sslprotocol="tls"
keystorefile="conf\server02.jks" keystorepass="123456"
truststorefile="conf\server02.jks" truststorepass="123456"/>
注:server02.jks是证书存贮文件
3. 安装客户端证书dwp.p12
3. 修改tomcat配置,使其自动启用ssl
打开d:\test\tomcat51\webapps\jsp-examples\web_inf\web.xml 文件,在security-constraint 标签下,增加如下内容:
<user-data-constraint>
<description>
constrain the user data transport for the whole application
</description>
<transport-guarantee>confidential</transport-
-
相关文章
2秒记住本站域名
玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn
