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

<Directory {{ wp_root_dir }}/web>
  AllowOverride All
  Options FollowSymLinks
{% if wp_src_ip | length > 0 %}
  Require ip {{ wp_src_ip | join(' ') }}
{% else %}
  Require all granted
{% endif %}
  <FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php-fpm/{{ wp_php_fpm_pool | default('wp_' + wp_id | string) }}.sock|fcgi://localhost"
  </FilesMatch>

  <FilesMatch "(\.ansible_version|\.git.*|wp-config.php)">
    Require all denied
  </FilesMatch>
</Directory>

<Directory {{ wp_root_dir }}/web/wp-content>
  <Files *.htacess>
    Require all denied
  </Files>
  <FilesMatch "\.(jhtml|jnlp|jvs|jws|php|exe|src|bin|sh|pl|swf)$">
    order allow,deny
    deny from all
  </FilesMatch>
  <FilesMatch \.php$>
    SetHandler None
  </FilesMatch>
</Directory>

