| Creating a self-signed SSL certificate |
|
|
|
Preliminary Steps - Install apache (sudo apt-get install apache2) Run the SSL certificate generating script
/usr/sbin/apache2-ssl-certificate -days 365 An alternative is to modify the /usr/sbin/apache2-ssl-certificate script itself. If you open this script with an editor, you can see that it's just a thin shell over native openssl commands. Make a back up this script. You'll see a portion in it that looks like this: export RANDFILE=/dev/randomChange it to this if want your self-signed cert. to last a full year: export RANDFILE=/dev/random
apache2-ssl-certificate Enable SSL
a2enmod ssl Establish a necessary symlink
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl Set up the document roots
cd /var/www Configure virtual hosts To configure HTTP over port 80 (edit /etc/apache2/sites-available/default): NameVirtualHost *:80 Similar procedure for HTTPS over port 443 (edit /etc/apache2/sites-available/ssl): NameVirtualHost *:443 Instruct apache2 to listen to 443 Go to this file /etc/apache2/ports.conf and add the following to it: Listen 443 I noted with Ubuntu 7.10, the ports.conf may already have an IfModule clause in it for the SSL portion: <IfModule mod_ssl.c> Turn on the SSL engine In the middle of /etc/apache2/sites-available/ssl file, after the commented area which says "# Possible values include: debug, info, notice, warn, error, crit..." add the following: SSLEngine On Make an /etc/hosts tweak (if need be) -- and restart apache When starting and stopping Apache there may be a complaint such as "Could not determine the server's fully qualified domain name, using 127.0.1.1 for ServerName". You may encounter this if you don't have a DNS name for your server, and are just using a dynamic IP. If this applies to you, go into your /etc/hosts file and make the following changes. Basically, we'll be adding "localhost.localdomain" to the 127.0.0.1 IP and whatever system name you chose when you installed Ubuntu (assuming you've not changed it). The final line below should be there if you have a static IP, and corresponding DNS name registered to it. If this is the case, earlier steps that wanted ServerName should have a value which corresponds to the DNS name also indicated here. 127.0.0.1 localhost localhost.localdomain {your system name} It may be that I first noticed additional behavior with Ubuntu 8.04 Hardy Heron. If you don't have a fully qualified domain name (FQDN) for your box, you may need to make an additional tweak. In your /etc/apache2/apache2.conf file, you may want to add the following line at the very end of the file if apache is still complaining about lacking a fully qualified domain name at startup: ServerName localhost Restart apache. cd /etc/init.d Original article: Creating a self-signed SSL certificate: Ubuntu Related articles: |




