WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Setup Ubuntu with SSL (for Drupal)

Submitted by barnettech on Tue, 08/09/2011 - 09:35

I have this working, SSL is setup for Drupal 7

1.) At the bottom of apache2.conf file in /etc/apache2

#setup name based virtual hosting instead of IP based (JLB)
NameVirtualHost *:443
NameVirtualHost *:80

2.) In /etc/apache2/sites-available/default-ssl

Make sure in below AllowOverride is set to all and not none! (2 instances of this in the file)
Make sure you've setup and generated these files as listed in the file below:
SSLCertificateFile /etc/ssl/certs/drupalprod.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
SSLCACertificateFile /etc/ssl/intermediate.crt

Most folks have trouble with their certs because they forget the intermedite.crt file I believe

>VirtualHost *:443>
        ServerAdmin webmaster@localhost
        SSLEngine On
        SSLCertificateFile    /etc/ssl/certs/drupalprod.crt
        SSLCertificateKeyFile /etc/ssl/private/server.key
        SSLCACertificateFile /etc/ssl/intermediate.crt
        DocumentRoot /var/www/drupal7
        
                Options FollowSymLinks
                AllowOverride all
        
        
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

        Alias /doc/ "/usr/share/doc/"
        
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 127.0.0.0/255.0.0.0 ::1/128
        

</VirtualHost>

3.) In the sites-available directory when you setup your file for your virtual
host that will have SSL on it make sure it uses port 443 and not 80


  ServerName drupalprod.babson.edu
  DocumentRoot /var/www/drupal7
  SSLEngine on
  SSLCertificateFile    /etc/ssl/certs/drupalprod.crt
  SSLCertificateKeyFile /etc/ssl/private/server.key
   
      Options +Indexes +FollowSymLinks +ExecCGI
      DirectoryIndex index.php
      AllowOverride All
      Order allow,deny
      Allow from all