<Directory /usr/share/BackupPC/>
  SSLRequireSSL on
{% if bpc_auth == "lemonldap" %}
  PerlHeaderParserHandler Lemonldap::NG::Handler
{% elif bpc_auth == "lemonldap2" %}
  PerlHeaderParserHandler Lemonldap::NG::Handler::ApacheMP2
{% elif bpc_auth == "basic" %}
  AuthType Basic
  AuthUserFile /etc/BackupPC/apache.users
  AuthName "BackupPC"
  Require valid-user
{% endif %}

{% if bpc_src_ip | length < 1 %}
  Require all denied
{% else %}
  Require ip {{ bpc_src_ip | join(' ') }}
{% endif %}
</Directory>

{% if bpc_auth != False and bpc_auth != 'none' and bpc_alias_on_main_vhost == True %}
Alias           /BackupPC/images        /usr/share/BackupPC/html/
ScriptAlias     /BackupPC               /usr/share/BackupPC/sbin/BackupPC_Admin
ScriptAlias     /backuppc               /usr/share/BackupPC/sbin/BackupPC_Admin
{% endif %}
