# Apache static configuration
# Automatically generated

# Basic server configuration
PidFile "${:pid_file}"
Listen ${:ip}:${:port}
PHPINIDir ${:php_ini_dir}
ServerAdmin someone@email
TypesConfig conf/mime.types
ScriptSock ${:cgid_sock}
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml .php5 .php4
AddType application/x-httpd-php-source .phps

# Log configuration
ErrorLog "${:error_log}"
LogLevel warn
LogFormat "%h %{REMOTE_USER}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %{REMOTE_USER}i %l %u %t \"%r\" %>s %b" common
CustomLog "${:access_log}" common

# Directory protection
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory ${:document_root}>
  Options FollowSymLinks
  AllowOverride All
  Require all granted
</Directory>
DocumentRoot ${:document_root}
DirectoryIndex index.html index.php

# List of modules
LoadModule unixd_module modules/mod_unixd.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so
LoadModule dir_module modules/mod_dir.so
LoadModule php5_module modules/libphp5.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule autoindex_module modules/mod_autoindex.so

## Settings for BOINC project ${:niceprojectname}

Alias /${:project} ${:installroot}/html/user
Alias /${:project}_ops ${:installroot}/html/ops
Alias /${:project}_result/ ${:installroot}/sample_results/
ScriptAlias /${:project}_cgi ${:installroot}/cgi-bin

# Note: projects/*/keys/ should NOT be readable!

<Directory "${:installroot}/html">
    Options Indexes FollowSymlinks MultiViews
    AllowOverride AuthConfig
     Require all granted
</Directory>

<Directory "${:installroot}/cgi-bin">
    Options ExecCGI
    AllowOverride AuthConfig
    Require all granted
</Directory>

Alias /${:project}_result/ ${:result_dir}
<Directory "${:result_dir}">
    Options +Indexes
    AuthName "${:project}"
    AuthType Basic
    AuthUserFile ${:installroot}/html/ops/.htpasswd
    require valid-user
</Directory>