Install SSL on Apache Web Server

VM created in Azure Cloud # Public IP --> 172.174.216.67

Connect via Putty

User : karthi@172.174.216.67

Password: <<when provisioning azure VM>>

Install apache2

Verify inbound ports 80 & 443 are allowed

Access using public IP: http://172.174.216.67/

Virtual Hosting:

Create a root folder for the domain (karthi.au) under /var/www and create a index.html page.

Create a configuration file under /etc/apache2/

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName karthi.au
    ServerAlias www.karthi.au
    DocumentRoot /var/www/karthi_au
    ErrorLog ${APACHE_LOG_DIR}/karthi_au_error.log
    CustomLog ${APACHE_LOG_DIR}/karthi_au_access.log combined
</VirtualHost>

Verify from browser: http://www.karthi.au

To Apply SSL:

Upload the certificates to the server under /etc/ssl/karthi_au

Create a configuration page for site (listening on 443)

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName karthi.au
    ServerAlias www.karthi.au
    SSLEngine on
    SSLCertificateFile /etc/ssl/karthi_au/certificate.crt
    SSLCertificateKeyFile /etc/ssl/karthi_au/private.key
    SSLCertificateChainFile /etc/ssl/karthi_au/ca_bundle.crt
    DocumentRoot /var/www/karthi_au
    ErrorLog ${APACHE_LOG_DIR}/karthi_au_error.log
    CustomLog ${APACHE_LOG_DIR}/karthi_au_access.log combined
</VirtualHost>

To redirect http:// request to https://, add redirect directive.

Redirect permanent / https://www.karthi.au

Verify SSL installation