• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    實例講解Apache+tomcat+ssl配置

    發布: 2007-6-22 07:38 | 作者:   | 來源:   | 查看: 17次 | 進入軟件測試論壇討論

    領測軟件測試網

       

        我的運行環境: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
    [logger.apache2]
    file=”D:/Apache2/logs/error.log”
    level=ERROR
    # Provide the basic config needed
    [config]
    file=D:/Apache2/conf/workers2.properties
    debug=1
    # Provide the location of shm file on the Apache web server
    [shm]
    file=D:/Apache2/conf/jk2.shm
    size=1000000

    [channel.socket:localhost:8009]
    port=8009
    host=localhost
    #define the worker
    [ajp13:localhost:8009]
    channel=channel.socket:localhost:8009
    # Map the Tomcat examples webapp to the Web server uri space
    [uri:/jsp-examples/*]
    [uri:/*.jsp]

        **編寫一個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-guarantee>
    </user-data-constraint>
     注釋掉<auth-constraint>標簽下的內容
    <auth-constraint>
             <!-- Anyone with one of the listed roles may access this area -->
             <role-name>tomcat</role-name>
         <role-name>role1</role-name>
          </auth-constraint>
    在web-resource-collection 標簽下,增加如下內容:
          <url-pattern>/*</url-pattern>
        重新啟動Apache和tomcat,
     
        訪問 http://localhost/jsp-examples/sessiontest.jsp是可是訪問的,這是系統提示用戶出示證書,啟用SSL加密通道,SSL建立后,返回結果。URL變為https://localhost:8443/jsp-examples/sessiontest.jsp

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>