You are hereBlogs / Enrix's blog / Apache 2.0: Encrypted connection

Apache 2.0: Encrypted connection


By Enrix - Posted on 03 December 2009

In order to make an encrypted connection between the client and the server we can act in two
ways.
1) Buying a certificate from a certificate authority as Verisign.Used often in
commercial sites
2) Creating a self-certificate which is used often whithin a intranet environment.

First of , we should create a private key to generate the CSR or later to
create a self signed certificate.
Creating private key:

openssl genrsa -out privatekey.key 1024

Creating a certificate request for an external certification authority or
Self-signed:

openssl req -new -key privatekey.key -out requestcertificate.csr

You will be asked a series of questions, among which the most important is the
domain name of your server in the indication of common name.

Is possible to create a self-signed certificate for our server, if we want to use it only for an intranet:
openssl x509 -req -days 3650 -in server.csrĀ  -signkey privatekey.key -out certificate.crt

After that we should modify the httpd.conf by entering:

Listen 443
uncomment #Include /etc/httpd/ extra/httpd-ssl.conf

and the file httpd-ssl.conf, also creating the appropriate directories:

SSLCertificateFile /etc/ssl/certs/certificate.crt
SSLCertificateKeyFile/etc/ssl/certs/privatekey.key

DocumentRoot "../directorymywebsite"
ServerName server.dominio: 443
SSLEngine on

Enjoy!

Tags

Translate in: