title: Apache Config for PHP and Web2Py
body: <p>I'm setting up a server for home to run all sorts of things. I'll save you the whole story, but I'm trying to get it to run Web2Py through WSGI, but also need to serve PHP files for other web apps I have. I tried the install script for Web2Py, but that "hijacked" the entire Apache system to run the Web2Py system.</p>
  
  <p>The setup currently works for PHP and SSL pages, but I cannot get it to also process requests for the Web2Py site. For the Web2Py url (<code>http://jupiter/web2py</code>), I get an Apache directory listing. Please help.</p>
  
  <p>The directory structure is this:</p>
  
  <ul>
  <li>/var/www  -->  Apache DocumentRoot</li>
  <li>/var/www/scripts  -->  various PHP scripts</li>
  <li>/var/www/web2py  -->  Web2Py</li>
  </ul>
  
  <p>The /etc/apache2/sites-available/default file is setup as this:</p>
  
  <pre><code>NameVirtualHost *:80
  &lt;VirtualHost *:80&gt;
      ServerAdmin me@yahoo.com
      ServerName jupiter.myhome.com
  
      WSGIDaemonProcess web2py user=www-data group=www-data display-name=%{GROUP}
      WSGIProcessGroup web2py
      WSGIScriptAlias /web2py /var/www/web2py/wsgihandler.py
  
  DocumentRoot /var/www
  &lt;Directory /&gt;
      Options FollowSymLinks
      AllowOverride None
  &lt;/Directory&gt;
  
  &lt;Directory /var/www&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow, deny
      allow from all
  &lt;/Directory&gt;
  
  &lt;Directory /var/www/web2py&gt;
      AllowOverride None
      Order Allow,Deny
      Deny from all
      &lt;Files wsgihandler.py&gt;
          Allow from all
      &lt;/Files&gt;
  &lt;/Directory&gt;
  
  AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/static/$2
  &lt;Directory /var/www/web2py/applications/*/static/&gt;
      Order Allow,Deny
      Allow from all
  &lt;/Directory&gt;
  
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  &lt;Directory "/usr/lib/cgi-bin"&gt;
      AllowOverride None
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow from all
  &lt;/Directory&gt;
  
  ErrorLog ${APACHE_LOG_DIR}/error.log
  
  #comment
  #comment
  LogLevel warn
  
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  </code></pre>
  
  <p></p>