Install SSL Certificate and Change To HTTPS


In this post, I will introduce how to install the SSL certificate for WordPress.


I did some research and tried different methods. Now I will provide the simplest ways.

  1. Apply for an SSL certificate;
  2. Download the certificate and sent it to the server;
  3. Do the following command: sudo yum install mod_ssl;
  4. Add a file httpd-ssl.conf to /etc/httpd/conf.d/, which will be loaded by httpd.conf in /etc/httpd/conf/;
    DocumentRoot "/var/www/html"
    SSLEngine on
    SSLCertificateFile /path/to/certificate/2_www.domain.com_cert.crt
    SSLCertificateKeyFile  /path/to/certificate/
    SSLCertificateChainFile /path/to/certificate/1_root_bundle.crt
  5. Restart Apache service apachectl stop and apachectl start;


Apply for an SSL certificate

I applied a free personal SSL certificate in the same site (Tencent Cloud) where I bought my domain.


I came across some bugs after adding the SSL configuration file.

[root@10-255-0-79 ~]# apachectl configtest
AH00526: Syntax error on line 5 of /etc/httpd/conf.d/httpd-ssl.conf:
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

I found that in my Apache installation, was outright missing. It turns out it is separate from the base installation and was under the package mod_ssl in the yum package manager. Simply do sudo yum install mod_ssl solve this problem.


Tencent Cloud Product Doc

Leave a Reply

Your email address will not be published. Required fields are marked *