From cfe126445401fb95bd5637ad344c37d89808f4b4 Mon Sep 17 00:00:00 2001 From: Chris Croome <chris@webarchitects.co.uk> Date: Mon, 14 Mar 2022 20:28:48 +0000 Subject: [PATCH] Allow access to Apache chroot dir when it exists --- templates/apache2.conf.j2 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/templates/apache2.conf.j2 b/templates/apache2.conf.j2 index ebccb6e..350a0f5 100644 --- a/templates/apache2.conf.j2 +++ b/templates/apache2.conf.j2 @@ -165,32 +165,37 @@ Include ports.conf # the latter may be used for local directories served by the web server. If # your system is serving content from a sub-directory in /srv you must allow # access here, or in any related virtual host. -<Directory /> +<Directory "/"> Options FollowSymLinks AllowOverride None Require all denied </Directory> -<Directory /usr/share> +<Directory "/usr/share"> AllowOverride None Require all granted </Directory> -<Directory /var/www/> +<Directory "/var/www/"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> +<IfFile "{{ apache_chroot_dir }}/var/www"> + <Directory "{{ apache_chroot_dir }}/var/www/"> + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + </Directory> +</IfFile> + #<Directory /srv/> # Options Indexes FollowSymLinks # AllowOverride None # Require all granted #</Directory> - - - # AccessFileName: The name of the file to look for in each directory # for additional configuration directives. See also the AllowOverride # directive. -- GitLab