Deploy an SSL certificate on a Windows Tomcat server to enable HTTPS encryption and eliminate browser "Not Secure" warnings. This guide covers certificate preparation, Tomcat configuration, and deployment verification.
Requirements
Before you begin, make sure that the following requirements are met:
Certificate Status: You have an SSL certificate issued by a trusted certificate authority (CA). If your certificate is expiring or has expired, you must renew it first.
Domain Name Matching: Ensure the certificate covers all domain names you want to protect. If you need to add or change a domain name, you can purchase a paid certificate or add and replace domain names.
Exact domain name: An exact domain name certificate applies only to the specified domain name.
A certificate for
example.comapplies only toexample.com.A certificate for
www.example.comapplies only towww.example.com.
Wildcard domain name: A wildcard domain name certificate applies only to first-level subdomains.
A certificate for
*.example.comapplies to first-level subdomains such aswww.example.comanda.example.com.A certificate for
*.example.comdoes not apply to the root domainexample.comor multi-level subdomains such asa.b.example.com.
NoteTo match a multi-level subdomain, the Bound Domains field must include the specific domain name (for example,
a.b.example.com) or a corresponding wildcard domain name (for example,*.b.example.com).-
Server permissions: Use the
Administratoraccount or an account with administrator privileges. DNS Resolution: The domain name resolves to the server's public IP address.
-
Environment dependencies: Examples use Windows Server 2025 and Tomcat 9.0.105. Example installation directory:
C:\apache-tomcat-9.0.105.NoteSteps may vary depending on your OS or Tomcat version.
Procedure
Step 1: Prepare the SSL certificate
-
Go to the SSL Certificate Management page. In the Actions column of the target certificate, click More to open the certificate details page. On the Download tab, download the certificate for Server Type Tomcat.
-
Extract the downloaded certificate package. It contains a certificate file (.pfx or .jks) and a password file (.txt).
NoteIf you generated the CSR using OpenSSL or Keytool, the private key exists only on your local machine and is not included in the download. If lost, you must purchase a commercial certificate again and generate a new CSR and private key.
-
Upload the certificate and password files to a secure directory on your server. Example path:
D:\cert.NoteThe following steps use an Alibaba Cloud ECS instance as an example. For other server types, consult their documentation.
-
Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.
-
On the instance details page, click Connect and select Workbench. Follow the on-screen instructions to log on to the server desktop.
-
In the lower-left corner of the server desktop, click the Enabling menu. Find and open This PC, Computer, or File Explorer.
-
Under Redirected drives and folders, double-click workbench on ***. Drag the certificate file from your local machine into this directory, and then right-click the folder and select Refresh.

-
Copy the file to the
D:\certdirectory.ImportantWorkbench automatically deletes all uploaded files in the Redirected drives and folders directory when you disconnect, reconnect, or sign out. Use this directory for file transfers only.
-
Step 2: Configure the system and network environment
-
Open port 443 in the security group.
ImportantIf your server is deployed on a cloud platform, make sure that its security group allows inbound traffic on TCP port 443. Otherwise, the service is not accessible from the internet. The following operations use an Alibaba Cloud ECS instance as an example. For other cloud platforms, see their official documentation.
Go to the ECS Instances page, select the region where your target ECS instance is located, and click the instance name to go to the details page.
Click and make sure a rule exists with Action set to Allow, Protocol Type set to TCP, Port Range set to HTTPS(443), and Authorization Object set to Anywhere (0.0.0.0/0).
If such a rule does not exist, add one to the target security group. For more information, see Add a security group rule.
-
Open port 443 in the server firewall.
Log on to your Windows server, click the Start menu, and then open Control Panel.
Go to .
If the firewall is turned off as shown in the following figure, no further action is required.

If the firewall is turned on, follow these steps to allow HTTPS traffic.
In the left-side navigation pane, click and check whether an inbound rule exists for which Protocol is TCP, Local Port is 443, and Action is Block.
If such a rule exists, right-click the rule, select Properties, and on the General tab, change the action to Allow the connection. Then, click Apply.
Step 3: Deploy the certificate on Tomcat
-
Edit
server.xmlto configure SSL settings. Example path:C:\apache-tomcat-9.0.105\conf\server.xml.PFX example
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" maxParameterCount="1000"> <SSLHostConfig> <!-- Replace D:/cert/example.com.pfx with the actual path to your certificate file. Replace your_certificate_password with the content of the pfx-password.txt file. --> <Certificate certificateKeystoreFile="D:/cert/example.com.pfx" certificateKeystorePassword="your_certificate_password" certificateKeystoreType="PKCS12" type="RSA"/> </SSLHostConfig> </Connector>JKS example
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" maxParameterCount="1000"> <SSLHostConfig> <!-- Replace D:/cert/example.com.jks with the actual path to your certificate file. Replace your_certificate_password with the content of the jks-password.txt file. --> <Certificate certificateKeystoreFile="D:/cert/example.com.jks" certificateKeystorePassword="your_certificate_password" certificateKeystoreType="JKS" type="RSA" /> </SSLHostConfig> </Connector> -
Optional: Configure automatic HTTP-to-HTTPS redirection.
-
Edit
server.xml. Locate the HTTP connector (default port 8080) and set the redirectPort attribute to 443. Add the attribute if it does not exist.<!-- Tomcat listens on port 8080 by default. Change this to the actual HTTP port that you are listening on. --> <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" maxParameterCount="1000" /> -
Add the following to the end of
web.xml:<security-constraint> <web-resource-collection> <web-resource-name>SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>NoteAfter saving, the server redirects all HTTP requests to HTTPS.
-
-
After saving the configuration, navigate to the
bindirectory of your Tomcat installation and restart the server for the SSL settings to take effect.-
Stop the Tomcat server.
shutdown.bat -
Start the Tomcat server.
startup.bat
-
Step 4: Verify the deployment
Access your domain name over HTTPS. Example:
https://example.com. Replaceexample.comwith your actual domain name.If a lock icon appears in the browser's address bar, the certificate is deployed successfully. If an access error occurs or the lock icon does not appear, clear your browser's cache or try again in incognito or private mode.

Starting with Chrome 117, the
icon in the address bar has been replaced by a new
icon. Click this icon to view the security lock information.
If the issue persists, see the FAQ section for troubleshooting.
Deploying to production
When you deploy an application in a production environment, follow these best practices to improve security, stability, and maintainability:
Run the application as a non-administrator user:
Create a dedicated, low-privilege system user for the application. Do not run the application by using an account that has administrative permissions.
NoteWe recommend that you use a gateway-level SSL configuration. This involves deploying the certificate on a reverse proxy, such as an SLB or Nginx instance. The reverse proxy terminates HTTPS traffic and then forwards the decrypted HTTP traffic to the backend application.
Externalize credential management:
Do not hard-code sensitive information, such as passwords, in your code or configuration files. Use environment variables, a vault, or a Key Management Service provided by your cloud provider to inject credentials.
Enforce HTTP-to-HTTPS redirection:
Make sure that all traffic that accesses your website over HTTP is automatically redirected to HTTPS. This helps prevent man-in-the-middle (MITM) attacks.
Configure modern TLS protocols:
In your server configuration, disable obsolete and insecure protocols, such as SSLv3, TLS 1.0, and TLS 1.1. Enable only TLS 1.2 and TLS 1.3.
Monitor certificates and automate renewal:
After the certificate is deployed, we recommend that you enable domain name monitoring. Alibaba Cloud automatically checks the validity period of the certificate and sends reminders before the certificate expires. This helps you renew the certificate in a timely manner to prevent service interruptions. For more information, see Purchase and enable public domain name monitoring.
FAQ
Certificate not working or HTTPS inaccessible
Common causes:
-
Port 443 is blocked by the server's security group or firewall. Configure the system and network environment.
-
The domain name is not included in the certificate's Bound Domains. Domain name match.
-
Tomcat was not restarted after modifying the configuration. Stop and restart the Tomcat service.
-
The certificate file was not replaced correctly, or the path in the Tomcat configuration is incorrect. Verify that both the configuration and certificate file are current and valid.
The domain name is integrated with cloud services such as CDN, SLB, or WAF, but the certificate is not installed on the corresponding service. For more information, see Certificate deployment location when traffic passes through multiple cloud services.
The domain name resolves to multiple servers, but the certificate is installed on only some of them. You must install the certificate on each server.
For further troubleshooting, see Troubleshoot certificate deployment issues based on browser errors and SSL certificate deployment troubleshooting guide.
Update an SSL certificate in Tomcat
Back up the existing certificate files (.pfx or .jks and the .txt file) on your server. Download the new certificate files from the Certificate Management Service console and upload them to overwrite the existing files. Keep the same paths and filenames. Restart Tomcat for the new certificate to take effect.
After I restart Tomcat, the service fails to start and the log (catalina.log) shows a LifecycleException or Keystore was tampered with, or password was incorrect error.
Common causes:
-
Incorrect password:
The
certificateKeystorePasswordvalue inserver.xmldoes not match the actual certificate password. Verify the password—it is case-sensitive. -
Incorrect certificate path:
The path in
certificateKeystoreFileis incorrect. Check for typos and consider using a path relative to theconf/directory. -
Mismatched keystore type:
The
certificateKeystoreTypedoes not match the actual certificate file format. UsePKCS12for PFX files andJKSfor JKS files. -
Special characters in the password:
The password contains XML special characters such as
&,<, or>that are not properly escaped in theserver.xmlfile.
Automatic HTTP to HTTPS redirection
Follow the Set up automatic redirection from HTTP to HTTPS section. Restart Tomcat after modifying the configuration.