Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Installing a Private Certificate on a Tomcat Server

Updated on 2023-07-26 GMT+08:00

This topic describes how to install a private certificate on a Tomcat 7 server running a Linux OS.

NOTE:

The installation procedure in this topic is for your reference only as the commands executed and configuration file modified during the installation may vary depending on OS types and server configurations.

Prerequisites

  • The certificate has been issued.
  • You have downloaded the private certificate in the format that is supported by Tomcat. For details, see Downloading a Certificate.
  • You have used a system-generated CSR to apply for the certificate.

Constraints

  • Before installing the certificate, enable port 443 on the server where the private certificate is installed and add port 443 to the security group. Otherwise, HTTPS cannot be enabled after the installation.
  • A root CA must be added to the trusted client CA list so that all server certificates issued by the root CA can be trusted by the client. For details, see Trusting a Private Root CA.
  • If a domain name maps to multiple servers, deploy the certificate on each server.
  • A private certificate can only be installed on the server that maps to the domain name associated with the certificate. Otherwise, the web browser will display a message indicating that the domain name is insecure.

Procedure

The installation process is as follows (for Tomcat 7 servers):

Step 1: Obtaining FilesStep 2: Creating a DirectoryStep 3: Modifying Configuration FilesStep 4: Restarting the TomcatVerifying the Result

Step 1: Obtaining Files

Decompress the downloaded Tomcat certificate file to obtain the certificate file server.jks and password file keystorePass.txt.

Step 2: Creating a Directory

Create a cert directory in the Tomcat installation directory, and copy the server.jks and keystorePass.txt files to the cert directory.

Step 3: Modifying Configuration Files

NOTICE:

Before modifying the configuration file, back up the configuration file. You are advised to deploy the configuration file in the test environment and then configure it on the production environment to avoid service interruptions caused by incorrect configurations.

The installation process is as follows (for Tomcat 7 servers):
  1. Find the following parameters in the server.xml file in the Tomcat installation directory conf:
    <!--
        <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" />
        -->
  2. Find the preceding parameters and delete the comment characters <!- - and - ->.
  3. Add the following parameters. Change the values of the parameters according to Table 1.
    keystoreFile="cert/server.jks"
    keystorePass="Certificate key"

    The complete example configuration is as follows. Modify other parameters based on your needs.

    <Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
          keystoreFile="cert/server.jks"
        keystorePass="Certificate key"
          clientAuth="false" sslProtocol="TLS" />
    NOTICE:

    Do not directly copy all configuration. Only parameters keystoreFile and keystorePass need to be added. Set other parameters based on site requirements.

    Table 1 Parameter description (1)

    Parameter

    Description

    port

    Port number to be used on the server. You are advised to set the value to 443.

    protocol

    HTTP protocol. Retain the default value.

    keystoreFile

    Path for storing the server.jks file. The value can be an absolute path or a relative path. Example: cert/server.jks

    keystorePass

    Password of server.jks. Set this parameter to the password provided in the keystorePass.txt file.

    NOTICE:

    If the password contains &, replace it with &amp; to avoid configuration failure.

    An example command is provided as follows:

    If the password is keystorePass="Ix6&APWgcHf72DMu", change it to keystorePass="Ix6&amp;APWgcHf72DMu".

    clientAuth

    Whether to require all customers to show the security certificate and authenticate their identity. Retain the default value.

  4. Find the following parameters in the server.xml file in the Tomcat installation directory conf:
    <Host name="localhost"  appBase="webapps"
          unpackWARs="true" autoDeploy="true">
  5. Change the value of Host name to the domain name bound to the certificate.

    The complete configuration is as follows (www.domain.com is used as an example):

    <Host name="www.domain.com"  appBase="webapps"
          unpackWARs="true" autoDeploy="true">
  6. Save the configuration file.

Step 4: Restarting the Tomcat

Run the ./shutdown.sh command in the bin directory of Tomcat to stop the Tomcat service.

After 10 seconds, run the ./startup.sh command to start the Tomcat service. If the process is automatically started by the daemon process, you do not need to manually start the process.

Verifying the Result

After the deployment succeeds, in the address bar of the browser, enter https://Domain name and press Enter.

If a security padlock is displayed in the address bar of the browser, the certificate has been installed successfully.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback