Monday, August 3, 2015

In this post I'll explain you how to install Apache2 Server and enable SSL for Apache2. Here I'm working on ubuntu 14.04 LTS. So lets get started.

Installing Apache2

First Lets update the Ubuntu repositories.

sudo apt-get install udgrade
sudo apt-get install update

Now Lets install apache2

sudo apt-get install apache2

Enable SSL in Apache Server

Create a directory as shown below,

sudo mkdir /etc/apache2/ssl

Now go to the created directory

cd /etc/apache2/ssl

Creating the certificates. 

Execute the following commands to create the key

sudo openssl genrsa -out "apache.key" 2048

Execute the the following to create the certificate sign request

sudo openssl req -new -key "apache.key" -out "apache.csr"

Fill information similar to following whencreating the CSR



Lets Sign the Key

sudo openssl x509 -req -days 3650 -in "apache.csr" -signkey "apache.key" -out "apache.crt"


Now Enable SSL module, if this is module is not installed you will have to install it :). Execute following to enable SSL in apache2

sudo a2enmod ssl

Now add the following to 000-default.conf in sites-enabled which is located at /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:443>
   
    SSLEngine on
    SSLCertificateFile  /etc/apache2/ssl/apache.crt
    SSLCertificateKeyFile /etc/apache2/ssl/apache.key

</VirtualHost>

Note : You can define server names and other parameters when configurin this further, above is the minimum content that is required.

Now restart the server.


sudo service apache2 restart

That is it, Now you are good to go :).

Please drop a comment if you have any Queries.


Categories: ,

0 comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!