Create Self-Signed Apache SSL Certificate on Debian / Ubuntu

Written by James McDonald

August 16, 2011


Firstly you need to install the correct package to have the make-ssl-cert command available:

sudo apt-get install ssl-cert

Then do the following as root or prepend sudo to each command:
Create a self-signed certificate using the make-ssl-cert utility

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf  /etc/apache2/ssl/myhost.example.com.crt

You will be prompted to enter the hostname. The rest is automagic

You need to change the SSLCertificateFile option in your Apache2 conf to point to the right place

# find which file it's in using fgrep
cd /etc/apache2
fgrep  SSLCertificateFile . -R
...
./sites-available/default-ssl:  SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
...

# edit it
vi ./sites-available/default-ssl

SSLCertificateFile ssl/myhost.example.com.crt

# restart apache

service apache2 reload

Version I did this on:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.04
Release:        9.04
Codename:       jaunty

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...