# whimsy.local Virtual Host
#
# Required modules: mod_cgi
# Required modules: mod_expires
# Required modules: mod_rewrite
# Required modules: mod_ldap
# Required modules: mod_authnz_ldap

<VirtualHost *:80>
  SetEnv PATH /opt/local/bin:/usr/local/bin:${PATH}
  PassengerFriendlyErrorPages on

  Servername whimsy.local
  DocumentRoot /Users/clr/apache/git/whimsy/www

  ## Logging
  ErrorLog "/var/log/apache2/whimsy_error.log"
  ServerSignature Off
  CustomLog "/var/log/apache2/whimsy_access.log" combined

  ExpiresActive On
  <If "%{QUERY_STRING} =~ /^\d+$/">
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
  </If>

  RewriteEngine on
  RewriteRule ^.*$ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  <Directory /Users/clr/apache/git/whimsy/www>
    Require ip 127.0.0.1
    Require ip ::1
    Options +ExecCGI +Indexes +FollowSymLinks +MultiViews
    AddHandler cgi-script .cgi
    MultiViewsMatch Any
  </Directory>

  Alias /racktest/ /Users/clr/apache/git/whimsy/www/racktest/public

  <Location /racktest>
    PassengerBaseURI /racktest
    PassengerAppRoot /Users/clr/apache/git/whimsy/www/racktest
    Options -MultiViews
    # CheckSpelling Off
    # SetEnv HTTPS on
  </Location>

  Alias /board/agenda/ /Users/clr/apache/git/whimsy/www/board/agenda/public

  <Location /board/agenda>
    PassengerBaseURI /board/agenda
    PassengerAppRoot /Users/clr/apache/git/whimsy/www/board/agenda
    Options -MultiViews
    # CheckSpelling Off
    # SetEnv HTTPS on
  </Location>

  <Directory /Users/clr/apache/git/whimsy/www/board/agenda>
    AuthType Basic
    AuthName "ASF Members and Officers"
    AuthBasicProvider ldap
    AuthLDAPUrl "ldaps://ldap-lb-us.apache.org:636 ldap1-us-west.apache.org:636/ou=people,dc=apache,dc=org?uid"
    AuthLDAPGroupAttribute memberUid
    AuthLDAPGroupAttributeIsDN off
    Require ldap-group cn=committers,ou=groups,dc=apache,dc=org
  </Directory>

  Alias /roster/ /Users/clr/apache/git/whimsy/www/roster/public

  <Location /roster>
    PassengerBaseURI /roster
    PassengerAppRoot /Users/clr/apache/git/whimsy/www/roster
    Options -MultiViews
    # CheckSpelling Off
    # SetEnv HTTPS on
  </Location>

  <Directory /Users/clr/apache/git/whimsy/www/roster>
    AuthType Basic
    AuthName "ASF Committers"
    AuthBasicProvider ldap
    AuthLDAPUrl "ldaps://ldap-lb-us.apache.org:636 ldap1-us-west.apache.org:636/ou=people,dc=apache,dc=org?uid"
    AuthLDAPGroupAttribute memberUid
    AuthLDAPGroupAttributeIsDN off
    Require ldap-group cn=committers,ou=groups,dc=apache,dc=org
  </Directory>

  <Directory /Users/clr/apache/git/whimsy/www/officers>
    AuthType Basic
    AuthName "ASF Members and Officers"
    AuthBasicProvider ldap
    AuthLDAPUrl "ldaps://ldap-lb-us.apache.org:636 ldap1-us-west.apache.org:636/ou=people,dc=apache,dc=org?uid"
    AuthLDAPGroupAttribute memberUid
    AuthLDAPGroupAttributeIsDN off
    Require ldap-group cn=committers,ou=groups,dc=apache,dc=org
  </Directory>

  # for secretary workbench
  Alias /members/received /Users/clr/apache/documents/received

  <Directory /Users/clr/apache/git/whimsy/www/secretary>
    AuthType Basic
    AuthName "ASF Secretarial Team"
    AuthBasicProvider ldap
    AuthLDAPUrl "ldaps://ldap-lb-us.apache.org:636 ldap1-us-west.apache.org:636/ou=people,dc=apache,dc=org?uid"
    AuthLDAPGroupAttribute member
    AuthLDAPGroupAttributeIsDN on
    Require ldap-group cn=asf-secretary,ou=groups,ou=services,dc=apache,dc=org
  </Directory>

  <Directory /Users/clr/apache/documents/received>
    Require all granted
  </Directory>

</VirtualHost>
