# vim: set ts=2 sw=2 et si sm:

WSGIDaemonProcess snapshot.debian.org user=nobody group=nogroup home=/ processes=4 threads=10 maximum-requests=5000 inactivity-timeout=1800 umask=0077 display-name=wsgi-snapshot.debian.org

<VirtualHost *:80>
  ServerName snapshot.debian.org
  ServerAlias snapshot-dev.debian.org snapshot-master.debian.org snapshot-*.debian.org snapshot.debian.net
  ServerAdmin team@snapshot.debian.org

  ErrorLog  /var/log/apache2/snapshot.debian.org-error.log
  CustomLog /var/log/apache2/snapshot.debian.org-access.log combined

  Alias /static      /srv/snapshot.debian.org/web/public/static
  Alias /robots.txt  /srv/snapshot.debian.org/web/public/robots.txt

  #Alias /git         /srv/snapshot.debian.org/snapshot.git
  SetEnv GIT_PROJECT_ROOT /srv/snapshot.debian.org/all-git
  AliasMatch ^/gits/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /srv/snapshot.debian.org/all-git/$1
  AliasMatch ^/gits/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /srv/snapshot.debian.org/all-git/$1
  ScriptAlias /gits/ /usr/lib/git-core/git-http-backend/

  RewriteEngine on
  RewriteRule ^/archive/backports.org/(.*) /archive/debian-backports/$1 [L,R]
  RewriteRule ^/git/(.*) /gits/snapshot.git/$1 [PT]

  RewriteCond  %{HTTP_HOST} ^snapshot.debian.net$
  RewriteRule ^/(.*)$ http://snapshot.debian.org/ [R]


  <Directory /srv/snapshot.debian.org/htdocs>
    Order allow,deny
    Allow from all
  </Directory>

  WSGIScriptAlias / /srv/snapshot.debian.org/bin/snapshot.wsgi
  WSGIProcessGroup snapshot.debian.org
  #WSGIPassAuthorization On
</VirtualHost>

<VirtualHost *:80>
  ServerName snapshots.debian.org
  RedirectPermanent / http://snapshot.debian.org/
</VirtualHost>
