Let's say I'm developing a script for login.example.com. I have absolutely no access to login.example.com, but that page loads a script on assets.example.com (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 assets.example.com to my localhost (and set up Apache accordingly).

The only problem now is that the login page loads https://assets.example.com/script.js (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: https://help.ubuntu.com/11.10/serverguide/C/certificates-and-security.html

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.


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 https://example.com, 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

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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