Monday, December 10, 2007

Setting Up a Secure Apache 2 Server

http://www.informit.com/articles/article.aspx?p=30115&seqNum=1

Requirements

openssl-0.9.7g-2.12
openssl-devel-0.9.7g-2
httpd-2.0.58

Configuring Apache
#./configure --enable-module=so --enable-ssl --with-ssl=/usr/include/openssl
#make
#make install
#/usr/local/apache2/bin/httpd -l (to list available modules

Creating a Key Pair
#openssl req -new -key www.example.com.key -out www.example.com.csr
#openssl genrsa -des3 -out www.example.com.key 1024

to backup key (optional):
#./usr/local/ssl/bin/openssl rsa -noout -text -in www.example.com.key

Creating a Self-Signed Certificate
#openssl x509 -req -days 30 -in www.example.com.csr -signkey www.example.com.key -out www.example.com.cert

# chmod 400 www.example.com.key

Edit /usr/local/apache2/conf/ssl.conf
Listen 80
Listen 443
ServerName http://www.example.com
SSLEngine on
SSLCertificateFile \
/etc/ssl/certs/www.example.com.cert
SSLCertificateKeyFile \
/etc/ssl/certs/www.example.com.key

Starting the server
#/usr/local/apache2/bin/apachectl startssl

No comments: