`

Cinfigure Https in Tomcat

阅读更多

<!--[if !supportLists]-->1.    1. 在服务器中生成证书:(注:生成证书时,CN要和服务器的域名相同,如果在本地测试,则使用localhost)

keytool -genkey -alias keystore -keyalg RSA -keysize 1024 -validity 730 -keystore     C:\tomcat603\conf\server.keystore

 

C:\tomcat603\conf\server.keystore” 这个参数用来保存生产的密钥库

 

 

<!--[if !supportLists]-->2.    2. <!--[endif]-->导出证书,由客户端安装:

keytool -export -trustcacerts -alias keystore -file server.cer -keystore server.keystore –storepass changeit

注意“changeit 是你在第一部生产密钥库是设置的密码

 

 

3.客户端配置:为客户端的JVM导入密钥(将服务器下发的证书导入到JVM)

keytool -import -trustcacerts -alias keystore -file server.cer -keystore  %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit

 

注意“changeit 是你在第一部生产密钥库是设置的密码

 

在这一步可能有异常:java.io.IOException:keystore was tampered with,or password was incorrect

原因是在你的home目录下是否还有.keystore存在。如果存在那么把他删除掉,后再执行

或者删除"%JAVA_HOME%/JRE/LIB/SECURITY/CACERTS 再执行

 

 

. 更改你server.xml %Tomcat_home%/conf 目录下, 当前的我的tomcat版本是6.0.3

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" redirectPort="8443"

   SSLEnabled="true"

   maxThreads="150"

   scheme="https"

   secure="true"

   clientAuth="false"

   sslProtocol="TLS"

   keystoreFile="/conf/server.keystore"

   keystorePass="changeit" />

注意“changeit”你需要更改为你在第一步设置的password

 

 

关于配置,不同版本的tomcat可能不同, 可以参考如下的URL

http://www.iteye.com/topic/78274

http://hi.baidu.com/rover828/blog/item/4cde5db52e3430c837d3caae.html

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

http://tech.163.com/07/0209/09/36SLC0V3000915A1.html

 

 

Keytool的其他命令:

验证是否已创建过同名的证书
keytool -list -v -alias tomcat -keystore "%JAVA_HOME%/JRE/LIB/SECURITY/CACERTS" -storepass changeit
删除已创建的证书
keytool -delete -alias tomcat -keystore "%JAVA_HOME%/JRE/LIB/SECURITY/CACERTS" -storepass changeit..

 

 

 

 

分享到:
评论

相关推荐

    tomcat在myeclipse中的安装

    - 当控制台输出显示Tomcat已成功启动,比如出现“Server startup in XXX ms”这样的信息,表明Tomcat已经运行起来,可以开始部署和调试你的Java Web应用程序了。 8. **更改JDK配置(可选)** - 默认情况下,...

    tomcat-7_API_帮助文档

    In addition, Tomcat 7.0 uses the Eclipse JDT Java compiler for compiling JSP pages. This means you no longer need to have the complete Java Development Kit (JDK) to run Tomcat, but a Java Runtime ...

    Apache Tomcat 7

    Configure data sources and mail sessions using JNDI in Tomcat Configure logging for web applications deployed on Tomcat server Who this book is for This book is for those Web developers and/or ...

    java8源码-docker-tomcat8:在jre-8上运行Tomcat服务器8的简单docker镜像

    in Tomcat =&gt; Done! ======================================================================== You can now configure to this Tomcat server using: admin:1Bwjynh6rAb5 ======================================...

    springboot项目打成war包并部署到Linux的Tomcat中

    springboot项目打成war包并部署到Linux的Tomcat中流程目录:启动类继承`SpringBootServletInitializer`pom文件添加`war`mvn命令操作(clean、install)打好的war包部署到Linux的Tomcat中本地访问部署好的项目 ...

    mysql+httpd+PHP+tomcat

    rdynamic --with-client-ldflags=-all-static --enable-assembler --enable-local-infile --enable-thread-safe-client make make install ``` #### 3. 初始化数据库 ```bash /usr/local/mysql/bin/mysql_...

    nginx + tomcat集群搭建

    case "$1" in start) $nginx_path -c /usr/local/nginx/conf/nginx.conf ;; stop) $nginx_path -s stop ;; restart) $nginx_path -s reload ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; ...

    apache与tomcat整合-完整篇

    case "$1" in start) start ;; stop) stop ;; status) status $httpd; RETVAL=$? ;; restart) stop; start ;; condrestart) if [ -f /var/run/httpd.pid ]; then stop; start; fi ;; reload) reload ;; ...

    Jenkins Essentials.pdf

    Paperback: 170 pages ... Finally, you'll explore the automated deployment of an application in Tomcat, along with details on managing and configuring Jenkins based on your requirements by using plugins.

    linux下部署JAVAEE项目

    case "$1" in start) /usr/local/tomcat/bin/startup.sh ;; stop) /usr/local/tomcat/bin/shutdown.sh ;; restart) /usr/local/tomcat/bin/shutdown.sh /usr/local/tomcat/bin/startup.sh ;; *) echo ...

    JCreator配置JSP环境方法

    1. 在JCreator中依次选择`Configure`-&gt;`Options`-&gt;`Tools`-&gt;`New`-&gt;`Program`,将Tomcat安装目录下的`bin`文件夹中的`startup.bat`文件选中并添加到工具栏中,这样工具栏中会新增一个名为`startup`的选项。...

    thymeleafexamples-springmail-3.0-master.zip

    In order to run the application to should configure your SMTP server correctly. You can do this by modifying the values on src/main/resources/configuration.properties and src/main/resources/javamail....

    JBoss AS 5 Performance Tuning.pdf

    Preface JBoss AS 5 Performance Tuning will teach you how to deliver fast applications on ...to configure and develop web applications that get the most out of the embedded Tomcat web server.

    environments was not found on the java.library.path 问题的解决方法

    标题中的问题 "The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path" 指的是在启动Apache Tomcat时遇到的一个错误,...

    freebsd安装软件

    `./configure --localstatedir=/usr/local/mysql/var --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --...

    spring-boot-reference.pdf

    20.2.1. Logging changes in condition evaluation 20.2.2. Excluding Resources 20.2.3. Watching Additional Paths 20.2.4. Disabling Restart 20.2.5. Using a Trigger File 20.2.6. Customizing the Restart ...

    greenplum-db-6.2.1-rhel7-x86_64.rpm

    PXF bundles newer tomcat and jackson libraries. The PXF JDBC Connector now supports pushdown of OR and NOT logical filter operators when specified in a JDBC named query or in an external table query ...

    jira-manual.pdf

    For WAR/Webapp, you'll need to deploy the JIRA .war file on your chosen application server (e.g., Tomcat, WebSphere) and configure the database connection. 2.3. Setting up an External Database If ...

    Nutch搜索引擎培训讲义

    - 在Package Explorer中找到Nutch 1.2项目,右键选择“Build Path” &gt; “Configure Build Path”。 - 选择“Source”选项卡,将默认输出目录从`nutch1.2/bin`修改为`nutch1.2/_bin`。 - 对于bin文件夹,可以通过...

Global site tag (gtag.js) - Google Analytics