How Javaweb works by the http to https access protocol and domain names?

The visit http protocol javaweb engineering changes to https, what needs to be done several operations:

  1. By generating a certificate jre
  2. Tomcat configuration adjustment
  3. web.xm adjust the project configuration

DETAILED detailed below:

First, generate a certificate

   Switch to the open cmd jre java directory installation directory execute the following commands

   keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore "D:\DevDir\installPackage\tomcat\apache-tomcat-6.0.41\tomcat.keystore" -validity 3650

 

    Detailed instructions:
    1. specify a keystore the storetype-type 
    algorithm name 2.-keyalg birth certificates, RSA is an asymmetric encryption algorithm 
    3.-keysize size certificate 
    storage path 4.-keystore certificate file generated 
    5.- validity period of the certificate (unit: days)

   // where -alias is the alias of the certificate, RSA encryption algorithm, after -keystore is the path where the output certificate

  Then the prompts, until a correct date credential

If the whole process is the practice of using the password as consistent as possible, be familiar with much later adjusted

 

Second, configure tomcat

    Open tomcat server.xml file to find the position of the figure, it is adjusted in FIG.
  

  If in eclipse tomcat is performed using the testing step of adjusting arrangement disposed below the eclipse   

  

  The open tomat added under tomcat-users.xml file configuration of FIG.

 

Third, the project configuration file web.xml

   Open the New configuration web.xml

 After configuration is complete access to port 8443 using.

 如: https:192.168.30.212:8443

 

何使用tomcat,使用域名直接访问javaweb项目首页

准备工作:

1:一台服务器

2:配置好jdk,将tomcat上传到服务器并解压

3:将项目上传到tomcat的webaap目录下

4:配置tomcat的conf目录下的server.xml文件

确保80端口开放
修改tomcat使用80端口

  修改server.xml文件

1 <!-- port原值为8080,改为80 --> 
2 <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
3 
4 <!-- defaultHost原值为localhost,改为自己的域名 -->
5 <Engine defaultHost="www.shuangshipu.top" name="Catalina">
6 
7 <!-- name原值为localhost,改为自己的域名,并在Host标签中加入新的标签<Context path="" docBase="/项目名/"></Context>即可 -->
8 <Host appBase="webapps" autoDeploy="true" name="www.shuangshipu.top" unpackWARs="true">
9 <Context path="" docBase="/shuangshipu01/" reloadable="true"></Context>

 至此就可了!

Guess you like

Origin www.cnblogs.com/zhaosq/p/11274493.html