title: SSL on Apache2 with WSGI
body: <p>I am trying to set up SSL on a Django site I maintain and having a bit of trouble setting up my VirtualHost with SSL. I followed the instructions <a href="http://beeznest.wordpress.com/2008/04/25/how-to-configure-https-on-apache-2/" rel="noreferrer">here</a> but every time I try to restart apache, it tells me it cannot restart because of multiple virtualhosts usign the same wsgi config:</p>
  
  <pre><code>/etc/init.d/apache2 reload
  Syntax error on line 33 of /etc/apache2/sites-enabled/www.mydomain.com:
  Name duplicates previous WSGI daemon definition.
  ...fail!
  </code></pre>
  
  <p>I understand what is happening, just not how to fix it. Any suggestions are appreciated, thanks! Here is what my VirutalHosts file looks like:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin my@email.com
      ServerName mydomain.com
      ServerAlias www.mydomain.com
      DocumentRoot /sites/mydomain
  
      # WSGI Settings
      WSGIScriptAlias / /sites/mydomain/wsgi_handler.py
      WSGIDaemonProcess mydomain user=myuser group=mygroup processes=1 threads=1
      WSGIProcessGroup mydomain
  
      # Static Directories
      Alias /static /sites/mydomain/static/
      &lt;Location "/static"&gt;
              SetHandler None
      &lt;/Location&gt;
  
      Alias /img /sites/mydomain/img/
      &lt;Location "/img"&gt;
              SetHandler None
      &lt;/Location&gt;
  
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:443&gt;
      ServerAdmin my@email.com
      ServerName mydomain.com
      ServerAlias www.mydomain.com
      DocumentRoot /sites/mydomain
  
      # WSGI Settings
      WSGIScriptAlias / /sites/mydomain/wsgi_handler.py
      WSGIDaemonProcess mydomain user=myuser group=mygroup processes=1 threads=1
      WSGIProcessGroup mydomain
  
      # Static Directories
      Alias /static /sites/mydomain/static/
      &lt;Location "/static"&gt;
              SetHandler None
      &lt;/Location&gt;
  
      Alias /img /sites/mydomain/img/
      &lt;Location "/img"&gt;
              SetHandler None
      &lt;/Location&gt;
  
      # SSL Stuff
      SSLEngine On
      SSLCertificateFile /etc/apache2/ssl/crt/vhost1.crt
      SSLCertificateKeyFile /etc/apache2/ssl/key/vhost1.key
      &lt;Location /&gt;
              SSLRequireSSL On
              SSLVerifyClient optional
              SSLVerifyDepth 1
              SSLOptions +StdEnvVars +StrictRequire
      &lt;/Location&gt;
  &lt;/VirtualHost&gt;
  </code></pre>