Set up an SSL certificate for hostname on CentOS Web Panel

This tutorial doesn’t work anymore! (September 26, 2018)

If you just installed the CentOS Web Panel (see the link at the end of this article) you probably want to set up an SSL certificate for the server’s hostname. First all all, be sure to point the hostname to the server’s IPs/nameservers.

cwp ssl hostname

To set up an SSL certificate for hostname:

  1. Log in to CWP as root
  2. Navigate to User Accounts-> New Account
  3. Enter the details for the new account. For the Domain name enter the hostname (e.g. cwp-server.domain.com). 
  4. Click the Create button
  5. Go to Apache Settings->SSL Cert Manager.
  6. Look for AutoSSL tab/section. Choose the previously created username, the hostname domain and click the Install SSL button. You will see a message like AutoSSL installation for domain cwp1.plothost.com success!
  7. At the bottom of the page you will see the certification details :

    DocumentRoot: /home/cwp1/public_html
    SSLCertificateFile: /etc/pki/tls/certs/cwp1.plothost.com.cert
    SSLCertificateKeyFile: /etc/pki/tls/private/cwp1.plothost.com.key
    SSLCertificateChainFile: /etc/pki/tls/certs/cwp1.plothost.com.bundle

  8. Open the CWP File Manager and navigate to file  /usr/local/cwpsrv/conf/cwpsrv.conf. Click on the file to select it and then on the Edit button. 
  9. In the cwpsrv.conf file, change the name of the certificate and certificate key from the default:
     ssl_certificate /etc/pki/tls/certs/hostname.crt; 
     ssl_certificate_key /etc/pki/tls/private/hostname.key;

    to the names from step 7. In our case these are:

     ssl_certificate /etc/pki/tls/certs/cwp1.plothost.com.cert; 
     ssl_certificate_key /etc/pki/tls/private/cwp1.plothost.com.key;
  10. Click the Save file button and close the CWP File Manager window.
  11. Now go to CWP Settings->Reboot Server and click the Reboot Server Now button.
  12. Wait for a few minutes and you will be able to connect to CWP via https://hostname:2087. This is it  🙂 

The movie tutorial for this KB web article:

YouTube video removed!

Notice that generating the same certificate multiple times can lead at some point to Let’s Encrypt Authority errors. During testing, we got this error at one point:

[Fri Mar 23 15:57:42 EDT 2018] Sign failed: "detail":"Error creating new cert :: too many certificates already issued for exact set of domains: cwp.plothost.com: see https://letsencrypt.org/docs/rate-limits/"
[Fri Mar 23 15:57:42 EDT 2018] Please check log file for more details: /root/.acme.sh/acme.sh.log

Related KB article: How to install CentOS Web Panel

Share this post: