{% if glpi_alias is defined %}
Alias /{{ glpi_alias }} {{ glpi_root_dir }}/web
{% else %}
# No alias defined, create a vhost to access it
{% endif %}

<Directory {{ glpi_root_dir }}/web>
  AllowOverride All
  Options FollowSymLinks
{% if glpi_src_ip is defined %}
  Require ip {{ glpi_src_ip | join(' ') }}
{% else %}
  Require all granted
{% endif %}
  <FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php-fpm/{{ glpi_php_fpm_pool | default('glpi_' + glpi_id | string) }}.sock|fcgi://localhost"
  </FilesMatch>

  <FilesMatch "(.ansible_version|.git.*|(CONTRIBUTING|SUPPORT|CHANGELOG|COPYING)\.(md|txt))">
    Require all denied
  </FilesMatch>

</Directory>

{% for dir in [ 'scripts', 'locales', 'config', 'inc', 'vendor', '.github', 'bin' ] %}
<Directory {{ glpi_root_dir }}/web/{{ dir }}>
  Require all denied
</Directory>
{% endfor %}
