HostOnNet Blog

Configuring SSL site in Ubuntu Server

Looking for Linux Server Admin or WordPress Expert? We can help.

Create file

vi /etc/apache2/sites-available/YOUR-DOMAIN.EXTN-ssl.conf

Add following content

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
    ServerAlias www.YOUR-DOMAIN.EXTN
    ServerAdmin [email protected]
    DocumentRoot /home/YOUR-DOMAIN.EXTN/public_html/

    CustomLog ${APACHE_LOG_DIR}/YOUR-DOMAIN.EXTN-ssl.log combined
    ErrorLog ${APACHE_LOG_DIR}/error-YOUR-DOMAIN.EXTN-ssl.log
    SSLEngine on
    SSLCertificateFile  /etc/ssl/certs/YOUR-DOMAIN.EXTN.crt
    SSLCertificateKeyFile /etc/ssl/private/YOUR-DOMAIN.EXTN.key
    SSLCACertificateFile /etc/apache2/ssl.crt/

    <Directory "/home/YOUR-DOMAIN.EXTN/public_html/">
        Options All
        AllowOverride All
        Require all granted
        Order allow,deny
        allow from all


Enable the web site

a2ensite YOUR-DOMAIN.EXTN-ssl

Enable Apache SSL module if not already enabled

a2enmod ssl

Restart Apache

service apache2 restart

You can verify SSL module enabled by running

root@ip-172-31-32-78:~# apachectl -M | grep ssl
 ssl_module (shared)

Now web site will work with SSL certificate.

Posted in Apache

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.