Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I'm developing a script for I have absolutely no access to, but that page loads a script on (which I have access to). To test how well my new script works on the production login page, I changed my /etc/hosts to point to my localhost (and set up Apache accordingly).

The only problem now is that the login page loads (Again, I have no influence on this!). So in order for me to test my script, I need to set up a self-signed SSL cert.

I followed the directions here:

I also tried using the default-ssl to test it to no avail. I simply constantly get SSL connection error:

// Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. (Chrome)


Update: Since we're now at 12.04 LTS && 12.10, the tutorial should address these versions.

share|improve this question
 links to the same URL I listed in the question. The other one, though, might work. I'll try that out. – Nathan J. Brauer Feb 12 '13 at 12:07
(Wow, I just realized I typed "&&" in my update. I'll never be able to hide that I'm a programmer.) – Nathan J. Brauer Feb 12 '13 at 12:43
up vote 8 down vote accepted

At least on Ubuntu 12.10, it's crazy simple now.

sudo a2ensite default-ssl && sudo a2enmod ssl && sudo service apache2 restart

That's all.

Try it:

  • http:// localhost
  • https:// localhost (I can't link these due to restrictions.)
  • Try also with a custom domain (point anything at, like, via /etc/hosts)

The command spits out a readme file, but it's not really necessary.

Note: It's expected to get a cautionary message from the browser when accessing since it's a self-signed certificate.

PS: This assumes a normal and fresh-enough install the LAMP stack via tasksel install lamp-server

share|improve this answer
a2ensite and a2enmod ("apache2 enable site/module") have been around for a long time, even in Ubuntu 8.04 which was released in 2008! Your answer seems OK. – Lekensteyn Feb 12 '13 at 15:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.