Multiple SSL Certificate install on apache2 server [Ubuntu 12.04]



Multiple SSL Certificate install on apache2 server  [Ubuntu 12.04]
Enable SSL on your webserver
sudo a2enmod ssl
Follow up by restarting Apache.
sudo service apache2 restart
Copy your SSL certificate and key to any location
Eg. Here we copied to /etc/apache2/ssl  
Make sure permission of those files are 400 or 600 [root only read/write]
In   sites/sites-available/<your domains>

vim btlg.com.au
<VirtualHost *:80>
ServerName btlg.com.au 
ServerAlias 
www.btlg.com.au
DocumentRoot /home/bootleg/public_html
</VirtualHost>
<VirtualHost *:443>
ServerName btlg.com.au
ServerAlias 
www.btlg.com.au
DocumentRoot /home/bootleg/public_html
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/btlg/281027f6c6f445.crt
SSLCertificateKeyFile /etc/apache2/ssl/btlg/www_btlg_com_au.key 
SSLCertificateChainFile /etc/apache2/ssl/btlg/sf_bundle-g2-g1.crt
</VirtualHost>

vim example.com.au
<VirtualHost *:80>
ServerName btlg.com.au 
ServerAlias
example.com.au
DocumentRoot /home/example.com/public_html
</VirtualHost>
<VirtualHost *:443>
ServerName
example.com.au
ServerAlias www.example.com.au
DocumentRoot /home/example.com/public_html
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example/281027f6c6f445.crt
SSLCertificateKeyFile /etc/apache2/ssl/example/www_example_com_au.key 
SSLCertificateChainFile /etc/apache2/ssl/btlg/sf_bundle-g2-g1.crt
</VirtualHost>


Restart apache2 and browse to your domain with http or https
#######################################


On Ubuntu 14.04.1 x64 bit
Enable ssl

a2enmod ssl

Generate certificates  for site  example.com
----------------------------------------------------
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/example.com/apache.key -out /etc/apache2/ssl/example.com/apache.crt

**generate certificates for site example.org**
-------------------------------------------------------------
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/example.org/apache.key -out /etc/apache2/ssl/example.org/apache.crt
##Virtual Host Configuration <note:  the vhost file should have .conf extension###

root@server1:/etc/apache2/sites-available# vim  example.com.conf
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName example.org
        DocumentRoot /var/www/html/example.org

</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>

        ServerAdmin webmaster@localhost
        ServerName example.org
        DocumentRoot /var/www/html/example.org

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        SSLCertificateFile /etc/apache2/ssl/example.org/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/example.org/apache.key
</VirtualHost>

</IfModule>

#Configure ports

#cat /etc/apache2/ports.conf

NameVirtualHost *:80
NameVirtualHost *:443
Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

#Enable sites#
  a2ensite example.com
  a2ensite example.org

Step Four — Activate the SSL Virtual Host

Now that we have configured our SSL-enabled virtual host, we need to enable it.
We can do this by typing:
sudo a2ensite default-ssl.conf
We then need to restart Apache to load our new virtual host file:
sudo service apache2 restart


No comments:

Post a Comment