Monday, August 2, 2010

Starting Apache with built in SSL_MOD ( Linux RHEL5)

 First, I generate the certificates, and I copy them over /etc/httpd/conf/


openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Now, since there is no references to SSL on my httpd.conf file, I tried to add the line below to it.
LoadModule ssl_module modules/mod_ssl.so
However, the configtest test complains it is built-in and can't be loaded.
/etc/init.d/httpd configtest

No Nedd if already loaded 
Syntax error on line 8 of /etc/httpd/conf/httpd.conf:
module ssl_module is built-in and can't be loaded
So I tried adding the following parameters.

   Include conf/ssl.conf

Then restart the server.

/etc/init.d/httpd restart
Stopping httpd: [ OK ]

Now, I edited the /etc/httpd/conf.d/ssl.conf file to load my keys

ssl.conf

ServerName server.local
SSLEngine On
SSLCertificateFile /etc/httpd/conf/server.csr
SSLCertificateKeyFile /etc/httpd/conf/server.key

DocumentRoot /httpdocs/site/
ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/server--%Y%m%d 84600"
CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/server--%Y%m%d 84600" combined


However, apache won't start, as long I leave the SSLengine ON, 
/etc/init.d/httpd restart