title: How to configure apache 2.4 VirtualHost with wordpress and django wsgi on debian?
body: <p>I want to add a wordpress app at blog.mydomain.com but I already have a Django app at mydomain.com running with wsgi in deamon mode.</p>
  
  <p>I work on a Linux server (debian) with apache2.4.10 and PHP 5.6</p>
  
  <p>Here is my apache conf for mydomain.com (<strong>django.conf</strong>):</p>
  
  <pre><code>&lt;VirtualHost 000.000.000.000:443&gt; (my server ip)
      ServerName mydomain.com
      ServerAlias mydomain.com
      ServerAlias www.mydomain.com
  
      SSLEngine On
      SSLCertificateFile /pathToSsl/ssl.crt
      SSLCertificateKeyFile /pathToSsl/ssl.key
      SSLCertificateChainFile /pathToSsl/ssl.pem
      SSLVerifyClient None
  
      WSGIDaemonProcess       mydomain.com threads=4
      WSGIProcessGroup        mydomain.com
      WSGIScriptAlias /path/to/settings/wsgi.py
  
  
      # Aliases toward static data
      Alias /media /pathToMedia/media/
      Alias /static /pathToStatic/static/
      Alias /log /var/www/html/          
  
      &lt;Directory /path/to/settings&gt;
      &lt;Files wsgi.py&gt;
              Require all granted
      &lt;/Files&gt;   
      &lt;/Directory&gt;
      LogLevel warn
      CustomLog ${APACHE_LOG_DIR}/access-mydomain.com.log combined
      ErrorLog ${APACHE_LOG_DIR}/error-mydomain.com.log
      ErrorDocument 500 "Oups something goes wrong."
  &lt;/VirtualHost&gt;
  &lt;VirtualHost *:80&gt;
      ServerName mydomain.com
      ServerAlias mydomain.com
      ServerAlias www.mydomain.com
      Redirect / https:// mydomain.com/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>This one is working perfectly.</p>
  
  <p>And now I add a new configuration for my wordpress blog (<strong>wordpress.conf</strong>):</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName blog.mydomain.com
      DocumentRoot "/var/www/html/wordpress"
      &lt;Directory /var/www/html/wordpress&gt;
      AllowOverride all
      Options Indexes FollowSymLinks
      Require all granted
      &lt;/Directory&gt;
      LogLevel warn
      CustomLog ${APACHE_LOG_DIR}/access-blog.fr.log combined
      ErrorLog ${APACHE_LOG_DIR}/error-blog.fr.log
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The problem is when i try to access to blog.mydomain.com, I am redirected to mydomain.com after few seconds.</p>
  
  <p>At the beginning, I thought that was because my conf wordpress was not found but if I put</p>
  
  <pre><code>Redirect /  stackoverflow.com
  </code></pre>
  
  <p>in wordpress.conf and it's working. So the issue is not here.</p>
  
  <p>I find this in my apache error log for the wordpress blog :</p>
  
  <pre><code>[Mon Oct 24 13:15:55.829675 2016] [wsgi:error] [pid 16958] [client 000.000.000.000:38439] mod_wsgi (pid=16958): Exception occurred processing WSGI script '/path/to/settings/wsgi.py'., referer: http://blog.mydomain.com/
  [Mon Oct 24 13:15:55.829844 2016] [wsgi:error] [pid 16958] [client 000.000.000.000:38439] IOError: failed to write data, referer: http://blog.mydomain.com/
  </code></pre>
  
  <p>In my opinion, the problem come from wsgi, but i don't know why and how to resolve it. </p>
  
  <p>I don't understand why this conf go over wsgi.</p>
  
  <p>I hope you can help me.</p>
  
  <p>Thanks for reading.</p>