Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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)

Thanks!

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

share|improve this question
    
Duplicates? askubuntu.com/q/122360/6969 askubuntu.com/q/24829/6969 –  Lekensteyn Feb 12 '13 at 11:19
    
askubuntu.com/q/24829/6969 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

1 Answer 1

up vote 7 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 127.0.0.1, 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

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

 
discard

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.