If your Simple Application Server has a domain name attached, configure HTTPS encryption for the domain. This changes your data transmission protocol from HTTP to HTTPS at low cost, enabling website identity verification and encrypted data transmission to prevent data tampering or information leakage during transit. This topic uses a Simple Application Server running WordPress 5.8 as an example to show how to install an SSL certificate on your server and enable HTTPS encryption.
If your Simple Application Server was created using the WordPress 6.7.1 application image, you can enable HTTPS encryption with one click in the console. For more information, see Enable HTTPS with one click.
Background information
After you purchase and request a certificate through Certificate Management Service (formerly SSL Certificate) and deploy it to your web server, your web service transmits data over the HTTPS protocol. HTTPS establishes an SSL-encrypted channel between the client browser and your web server, enabling strong one-way encryption to prevent data leakage or tampering during transmission. HTTPS encryption is required for mobile apps, mini programs, code programs, controls, and other applications to be published in app stores or ecosystems. HTTPS encryption offers the following benefits:
-
Security compliance: Meets requirements of app stores or application ecosystems.
-
Encrypts network data: Encrypts communication between website users and your site, preventing data hijacking, tampering, and eavesdropping to ensure secure data transmission.
-
Improves website security: Helps avoid phishing incidents. Browsers display security indicators when users visit your site, increasing trust, traffic, and search rankings.
Prerequisites
-
You have created a Simple Application Server. For more information, see Quickly build a website using a WordPress application image.
-
You have purchased a domain name. To purchase a domain name from Alibaba Cloud, see Register a generic domain name.
-
If your Simple Application Server is deployed in the Chinese mainland, ensure your domain name has completed ICP filing. For more information, see What is ICP filing?.
-
Your domain name is already attached to your Simple Application Server and domain name resolution is complete. For more information, see Register and resolve a domain name.
Step 1: Purchase an SSL certificate
Purchase a certificate
-
Go to the Certificate Service purchase page.
-
Select the specifications for your certificate.
Parameter
Description
Example
Certificate Type
Select the type of domain to which the SSL certificate will be bound:
-
Single Domain: An SSL certificate that is bound to a single domain.
-
Wildcard Domain: Secures multiple subdomains at the same level, eliminating the need to purchase and install a separate certificate for each subdomain.
The following rules apply to wildcard domain matching:
-
The certificate matches only subdomains at the same level. For example, a certificate for *.aliyundoc.com can match demo.aliyundoc.com and learn.aliyundoc.com, but cannot match guide.demo.aliyundoc.com or developer.demo.aliyundoc.com.
-
You can apply for a certificate for only one wildcard domain. To include multiple wildcard domains in one certificate, you can combine multiple certificates of the same brand and type. For more information, see Combine certificate applications.
-
-
Multiple Domains: An SSL certificate that is bound to multiple single domains. You can use a single certificate to secure up to five domains.
NoteAlibaba Cloud provides a free domain name when you purchase a qualifying commercial certificate. For more information, see Purchase a commercial certificate.
Single Domain
Brand
Select the certificate brand (the CA that issues the certificate).
For more information about certificate brands, see SSL certificate selection guide.
Digicert
Certificate Specifications
Select the required certificate type.
For more information about different certificate types, see SSL certificate selection guide.
DV SSL
Domain Names
This parameter is required only when you select Multiple Domains. Select the number of single domains to bind to the SSL certificate.
1
Quantity
The number of SSL certificates to purchase. This value is fixed at 1. To purchase certificates for multiple consecutive years, set the Service Duration. For example, setting Service Duration to 2 Years provides two separate one-year certificates.
1
Service Duration
The duration of the SSL certificate service. Options:
-
1 Year: Provides a one-year SSL certificate service. The certificate is valid for one year and must be manually renewed upon expiration.
-
2 Years: Provides a two-year service that includes two one-year certificates and one year of the certificate hosting service.
For more information about certificate hosting, see What is certificate hosting?.
-
3 years: Provides a three-year service that includes three one-year certificates and two years of the certificate hosting service.
1 Year
-
-
Click Buy Now and complete the payment.
Submit a certificate request
Log in to the Certificate Management Service console.
In the navigation pane on the left, choose .
-
On the Commercial Certificate tab, find the certificate you purchased and click Apply for Certificate in the Actions column.
-
In the Apply for Certificate panel, configure the parameters, select the Quick Issue checkbox, and then click Submit.
Parameter
Description and example
Certificate Type
Single Domain
Certificate Specifications
digicert DV
Domain Name
The domain name to be secured by the certificate. This domain must be the one bound to your Simple Application Server instance. Example: aliyundoc.com
Validity Period (Years)
1
Quick Issue
Domain Verification Mode
-
If your domain uses Alibaba Cloud DNS under the same account, Certificate Management Service automatically selects Automatic DNS Verification. This method cannot be changed. The system completes verification automatically after you submit the application, so you only need to wait for the certificate to be issued.
-
If the domain name does not use Alibaba Cloud DNS or is managed by a different Alibaba Cloud account, you can select one of the following methods to verify domain ownership:
-
Manual DNS Verification: Requires you to manually add a TXT record in your DNS provider's console to verify domain ownership.
-
File Verification: Download a dedicated verification file from the Certificate Management Service console and upload it to the required verification directory on your web server.
-
Contact
From the drop-down list, select a contact. If no contact is available, click Create Contact to create one.
Make sure that the contact information is accurate and valid.
Region
Select your city or region.
Encryption Algorithm
The encryption algorithm of the SSL certificate. The default value is RSA and cannot be changed. RSA is a widely used asymmetric encryption algorithm that provides good compatibility.
CSR Generation
A Certificate Signing Request (CSR) is a file that contains server and company information and is submitted to a CA for review.
Select System Generated. Certificate Management Service automatically generates a CSR file by using the specified Encryption Algorithm.
-
-
If the Domain Verification Mode is Automatic DNS Verification, the system automatically completes the DNS verification. You only need to wait for the certificate to be issued. If the Domain Verification Mode is set to Manual DNS Verification or File Verification, you must follow the prompts in Verify Information to complete the domain ownership verification. For more information, see Domain ownership verification.
After you submit the certificate application, the CA typically reviews the application and issues the certificate within approximately 30 minutes. After the SSL certificate is issued, its Status changes to Issued.
Step 2: Configure the SSL certificate
After issuance, the certificate status changes to Issued. Deploy the SSL certificate to your server and configure it. For more information about certificate deployment and installation, see Deploy an SSL certificate.
-
Upload and deploy the SSL certificate.
-
In the navigation pane on the left, choose .
-
On the Deployment to Cloud Servers page, click Create Task.
-
On the Basic Configuration page, enter a custom task name and click Next.
-
On the Select Certificate page, choose the certificate type and associate the SSL certificate with your cloud server. Click Next.
-
On the Select Resource page, choose the appropriate cloud server and resources. Click Next.
-
The system automatically identifies and retrieves all eligible cloud server instances under your Alibaba Cloud account (those running web applications). If resources do not appear, verify that your cloud server runs a web application such as Nginx or Apache.
-
If a certificate was previously deployed to an instance, its name appears.
-
-
On the Deployment Configuration page, deploy the certificate to your cloud server as shown in the following table. Click OK.
ImportantIf the certificate configuration directory does not exist on your server, the system creates it automatically. The path configured in the console must match the certificate file path in your cloud server's web application configuration.
Configuration item
Description
Configuration example
Certificate Path
Set the absolute path for the certificate file on your cloud server.
/data/cert/certpublic.crt
Private Key Path
Set the absolute path for the private key file on your cloud server.
/data/cert/cert.key
Certificate Chain Path
Set the absolute path for the certificate chain file on your cloud server.
/data/cert/certchain.crt
Reload Command
After deploying the certificate, restart your web application or reload its configuration to activate the certificate. Enter the restart or reload command here.
ImportantRunning these commands might cause service startup failures. If this occurs, operate directly on your cloud server.
Not required.
-
In the confirmation dialog box, click OK.
-
-
-
Configure the SSL certificate.
-
Remotely connect to your Simple Application Server. For more information, see Remotely connect to a Linux server.
-
Run the following command to edit the vhost.conf configuration file.
NoteThis example assumes Apache is installed by default in your WordPress environment. Configuration file paths and names may vary—adjust according to your actual environment.
sudo vim /etc/httpd/conf.d/vhost.conf -
Press
ito enter edit mode. -
Add the following code to the configuration file.
Before using the example code, update these configuration items:
-
ServerName: Your domain name, for example: example.com.
-
DocumentRoot: Application directory, for example: /data/wwwroot/wordpress.
-
Directory: Application directory, for example: /data/wwwroot/wordpress.
-
SSLCertificateFile: Public key file path, for example: /data/cert/certpublic.crt.
-
SSLCertificateKeyFile: Private key file path, for example: /data/cert/cert.key.
-
SSLCertificateChainFile: Certificate chain file path, for example: /data/cert/certchain.crt.
ImportantIncorrect certificate file paths prevent HTTPS access.
Example configuration:
<VirtualHost *:443> # Bind domain to server ServerName example.com DocumentRoot "/data/wwwroot/wordpress" #ErrorLog "logs/example.com-error_log" #CustomLog "logs/example.com-access_log" common <Directory "/data/wwwroot/wordpress"> Options Indexes FollowSymlinks AllowOverride All Require all granted </Directory> SSLEngine on # Configure SSL certificate. Path must match deployment settings. SSLCertificateFile /data/cert/certpublic.crt SSLCertificateKeyFile /data/cert/cert.key SSLCertificateChainFile /data/cert/certchain.crt </VirtualHost> -
(Conditionally required) If you want to enable automatic redirection from HTTP requests to HTTPS, you also need to add configuration in <VirtualHost *:80>
Add the following configuration information to the code block.
#----------HTTP for WordPress Start-------- <VirtualHost *:80> ServerName example.com #ServerAlias example.com DocumentRoot "/data/wwwroot/wordpress" ErrorLog "logs/wordpress-error_log" CustomLog "logs/wordpress-access_log" common RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] <Directory "/data/wwwroot/wordpress"> Options Indexes FollowSymlinks AllowOverride All Require all granted </Directory> </VirtualHost> #----------HTTP for WordPress End---------
After editing, press
Esc, type:wq!, and pressEnterto save and exit. -
Run the following command to restart the service.
sudo systemctl restart httpd -
Run the following command to restart the database.
sudo service mysqld restart
-
Step 3: Verify the SSL certificate
-
Configure the HTTPS domain in the WordPress admin panel.
-
Log on to the WordPress admin panel.
For instructions on obtaining the admin panel URL, username, and password, see Quickly build a website using a WordPress application image.
-
In the navigation pane on the left, choose Settings > General.
-
In WordPress Address (URL) and Site Address (URL), enter your attached and resolved domain name. This example uses
https://example.com. -
Click Save Changes.
NoteAfter changing WordPress Address (URL) and Site Address (URL), the admin login URL becomes
https://example.com/wp-login.php. Replaceexample.comwith your actual domain.
-
-
Access
https://your Simple Application Server's domainin a browser.-
If a lock icon appears in the browser address bar, the SSL certificate is installed successfully.
-
If your site cannot be accessed via HTTPS, troubleshoot as follows:
-
Confirm that port 443 on your Simple Application Server is open and not blocked by other tools. For instructions on allowing port 443, see Manage firewall.
-
Verify ICP filing status. If your domain resolves to a server in the Chinese mainland, ensure ICP filing is complete. For more information, see What is ICP filing?.
-
Check certificate path configuration. Ensure the uploaded certificate path matches the configured path. For more information, see Configure SSL certificate.
-
-
References
Different server types support different SSL certificate formats. Choose the appropriate SSL certificate based on your server type. For more information, see Deploy an SSL certificate.