WSGIRestrictStdout Off
<VirtualHost *:80>
  ServerName my.server.name.org

  WSGIDaemonProcess web2py user=www-data group=www-data

 WSGIProcessGroup web2py
 WSGIScriptAlias / /path/to/myweb2py/wsgihandler.py

  <Directory /path/to/myweb2py/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

  AliasMatch ^/my_app_name/([^/]+)/static/(.*) \
           /path/to/myweb2py/applications/$1/static/$2
  <Directory /path/to/myweb2py/applications/*/static/>
    Order Allow,Deny
    Allow from all
  </Directory>


  <LocationMatch ^/my_app_name/([^/]+)/appadmin>
  Deny from all
  </LocationMatch>

  CustomLog /var/log/apache2/web2py-access.log common
  ErrorLog /var/log/apache2/web2py-error.log
</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName my.server.name.org
 WSGIScriptAlias / /path/to/myweb2py/wsgihandler.py



  SSLEngine on
  SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key


  <Directory /path/to/myweb2py/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

  AliasMatch ^/my_app_name/([^/]+)/static/(.*) \
           /path/to/myweb2py/applications/$1/static/$2
  <Directory /path/to/myweb2py/applications/*/static/>
    Order Allow,Deny
    Allow from all
  </Directory>

  CustomLog /var/log/apache2/secure-web2py-access.log common
  ErrorLog /var/log/apache2/secure-web2py-error.log


</VirtualHost>

</IfModule>

