ReadyGo!技术成就梦想 >> JAVA技术 >> 开源技术 >> 实例讲解apache+tomcat+ssl配置

实例讲解apache+tomcat+ssl配置

ReadyGo!技术成就梦想 www.efish.cn efish 2007-10-11 23:49:54

    我的运行环境: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-

责任编辑: efish 参与评论 查找更多: 核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级核心java基础j2eexmlj2sej2me问题解决核心技术高级
相关文章
web框架tomcat 5.0 的目录结构 tomcat下有9个目录,分别是bin,common,conf,logs,server,shared,temp,webapps,work 目录,现在对每..
tomcat向weblogic移植的中文乱码.. 我有个servlet处理含有中文的表单, 用new string(s.getbytes("iso8859-1"), "gbk")..
三种tomcat管理界面常用设置方式 1.登陆管理界面 http://localhost:8080/admin 密码和用户名在你安装的时候设定的,如果忘记(或没有)的话..
tomcat 5集群中的session复制二 集群安装    为了在tomcat5容器中session复制可用,必须完成以下步骤:    ●    为了集群能够..
tomcat5.5.9+sql2000数据库连接池.. 终于解决了困扰多天的连接池的问题,写下这编文章与大家一起分享。我是在tomcat5.5.9下配置的,tomcat5.5.x..
tomcat下jsp、servlet和javabean.. 经常看到jsp的初学者问tomcat下如何配置jsp、servlet和bean的问题,于是总结了一下如何tomcat下配置jsp、se..
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn

分类导航
ReadyGo!技术成就梦想