Install SSL Certificate on zPanel

The following is an simplified how to install SSL Certificate on zPanel. You can use a self-signed SSL Certificate or buy.

First create ssl directory to easy maintain:
$ mkdir /var/zpanel/hostdata/zadmin/ssl

Then go to ssl directory:
$ cd /var/zpanel/hostdata/zadmin/ssl

Generate private key. If you use a self signed SSL Certificate, you can use 1024 RSA key, but if you buy a certificate like InstantSSL, most of them need at least 2048 bit RSA key.
$ openssl genrsa -des3 -out server.key 2048

Generate CSR (Certificate Signing Request):
$ openssl req -new -key server.key -out server.csr

Remove Passphrase from Key
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key

If you want to use a self signed, generate a self signed certificate:
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Or if you want to buy a certificate, please submit server.key to a SSL Provider, then you’ll get .crt and .ca-bundle files.

Install the Private Key and Certificate.
Please make sure mod_ssl was installed on your server. If didn’t installed yet, you can install it.
For CentOS:
# yum install mod_ssl
For Ubuntu:
# apt-get install mod_ssl

Go Server Admin – Module Admin – Override a Virtual Host Setting – Select a domain and click Select Vhost:
On port override field, fill: 443
Check ‘Forward Port 80 to Overriden Port’ if you want to always use HTTPS
Fill IP Override with your Server IP Address.
If you use a self-signed certificate, fill custom entry with:
SSLEngine On
SSLCertificateFile /var/zpanel/hostdata/zadmin/ssl/server.crt
SSLCertificateKeyFile /var/zpanel/hostdata/zadmin/ssl/server.key
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/yourdirectory"

If you use trusted SSL Certificate, fill custom entry with:
SSLEngine On
SSLCertificateFile /var/zpanel/hostdata/zadmin/ssl/server.crt
SSLCertificateKeyFile /var/zpanel/hostdata/zadmin/ssl/server.key
SSLCertificateChainFile /var/zpanel/hostdata/zadmin/ssl/server.ca-bundle
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/yourdirectory"

Click Save VHost

Then final step restart apache:
#/etc/init.d/httpd stop
#/etc/init.d/httpd start

Posted in CentOS, Linux, Ubuntu, zPanel
13 comments on “Install SSL Certificate on zPanel
  1. Simsan says:

    Nice Post, I am trying to setup GoDaddy SSL. Hope will be successful.
    Thanks

  2. can says:

    can i use this tutorial for ubuntu 12.04

    • Arnas Risqianto says:

      yes, it should work for ubuntu

      • Chomps says:

        It will work up as far as “apt-get install mod_ssl”

        Run the command dpkg -S mod_ssl.so. Chances are that it will display something like:

        apache2.2-common: /usr/lib/apache2/modules/mod_ssl.so
        It means that mod_ssl is already installed on your system, as it does not come in a separate package, but it is bundled in apache2.2-common. Run

        a2enmod ssl
        to enable it, if it is not already enabled.

  3. Hello, I managed to install ssl certs on one of my websites running under zpanel, I applied a similar configuration to the one above to the httpd-vhosts.conf..Greetings

  4. john says:

    sh#t pffff it went wrong after i put the text in admin module select vhost.. i cant log in anymore.. ip cant find zpanel anymore or my websites linkt to the ip… can some one help me

  5. Ga mudeng sol ginian 🙁

  6. Linux VPS says:

    Nice to hear that, I would also make a backup of your vhosts file because when you do add a new domain from zpanel in future it seems to overwrite the ssl settings. So if you do have it backed up, you can easily add it again.

    • Arnas Risqianto says:

      Yes right since zpanel read from database then write into config file so when you change directly the config file, it’ll overwrite the config file when you add new domain.

  7. komputer says:

    artikelnya membantu sekali, terima kasih

Leave a Reply

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

*