Saturday, March 20, 2010

Configure Apache server ready for SSL suport by using httpd.conf

    This is relate to one of my previous blog post named as "Installing Apache 2.2.14". Their I have mentioned that further editing for the httpd.conf will come later. This is one of that.

    This is about enabling SSL in Apache server by editing the httpd.conf file. Lets check how can we do that.

     There are several ways to configure SSL (Secure Sockets Layer) in Apache. The easiest way is reconfigure Apache with enable SSL. It can be done as follows.

• First we have to go into the source file which we have downloaded. We can do it by using the following command in our terminal. (relate to the above mentioned post)
cd /path_of_the_file_location/

• Then we have to configure the Apache tree with enable SSL. We can use the following command.

./configure –prefix=/usr/local/apache2 –enable-ssl

• Next we have to build and install Apache by using following commands

make

make install

• Next step is to edit our httpd.conf file which locates in /usr/local/apache/conf . The things we have to edit in that are written below.

Listen 0.0.0.0:443

SSLEngine on

SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt

SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key

• Although we gave ssl.crt and ssl.key files above, there are no such directories in the mentioned location as default. We have to make those directories. The commands are as follows.

mkdir /usr/local/apache2/conf/ssl.crt

mkdir /usr/local/apache2/conf/ssl.key

• Now I had to create a self-signed server certificate for test purposes. The complete command is,

openssl req -new -x509 -days 365 -keyout /usr/local/apache2/conf/ssl.key/server.key -out /usr/local/apache2/conf/ssl.crt/server.crt -subj '/CN=Test-Only Certificate'

• Eventually I able to start Apache with SSL support.

/usr/local/apache2/bin/apachectl startssl


*** That's all ***

But you may confused "actually is it over?" Yes, you can check it by your self.
First have to do is place a web page on the relavant directory and try to access that page from your web browser through localhost. Then click on the small icon at the begining of the address bar. Then you will get a small popup and then you can understand what had happened.

***  Thanks for reading this blog **

No comments:

Post a Comment