Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I have a LAMP stack running. My the web root is /var/www.

So if I go to http://linux-server/some/page.php It renders the page located at /var/www/some/page.php

If I use https I get page not found.

I would like to enable SSL for all pages, so I can view any of these pages using either http or https.

How can I do that?

share|improve this question
up vote 6 down vote accepted

/etc/apache2/sites-available/default-ssl has the configuration for an http server. It can be enabled with the command sudo a2ensite default-ssl.

You will also need to enable mod ssl. This can be done with the command sudo a2enmod ssl. This will point you to /usr/share/doc/apache2.2-common/README.Debian.gz for directions on configuring SSL and generting a self-signed certificate. it can be viewed with the command zless /usr/share/doc/apache2.2-common/README.Debian.gz

Once you have the certificates installed, you can restart apache with the command sudo /etc/init.d/apache2 restart.

share|improve this answer
    
Got it working for the default host name but couldn't get it to work with multiple host names. – JD Isaacks Feb 7 '11 at 15:30
    
Scratch that, got it. – JD Isaacks Feb 7 '11 at 16:03
    
For 13.10 you don't need to generate & install self-signed certificates. After enabling mod_ssl and default-ssl, there is already an "Ubuntu" certificate. – Halil Özgür Oct 30 '13 at 12:15
    
@HalilÖzgür I have found Apache2 has always had a default certificate. The default self-signed certificate often doesn't match the name being published in DNS. In that case, a new certificate will need to be installed. Users who want a CA signed certificate will need to install and configure it. – BillThor Oct 30 '13 at 12:30
    
@BillThor I thought the question is about local test servers or self-signed certificates, where "invalid certificate" warnings can be ignored. – Halil Özgür Oct 30 '13 at 15:14

You can add it within apache or add it with a proxy (like nginx). I prefer setting up an SSL proxy locally or remotely in the first place. This way if I need to install a WAF or IDS later, there are less modifications required.

share|improve this answer

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.