From d4fb3945949561581532e301cf1aa5e4313c822e Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 15 Sep 2023 15:19:48 +0200
Subject: [PATCH] fix config for xsendfile

---
 .gitignore                                                 | 1 +
 docker/containers/web-server/Dockerfile                    | 2 +-
 .../web-server/apache/sites-enabled/vhost_app.conf         | 7 +++++--
 docker/init.sh.cfg                                         | 2 +-
 docker/templates/vhost_app.conf                            | 2 +-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index e1d0764..526bd4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 /packages/
 /public_html/inc_config.php
 /shellscripts/getfile.sh.cfg
+static/*
\ No newline at end of file
diff --git a/docker/containers/web-server/Dockerfile b/docker/containers/web-server/Dockerfile
index 6b7b12c..0c17062 100644
--- a/docker/containers/web-server/Dockerfile
+++ b/docker/containers/web-server/Dockerfile
@@ -7,7 +7,7 @@ FROM php:8.2-apache
 RUN apt-get update && apt-get install -y git unzip zip libapache2-mod-xsendfile
 
 # enable apache modules
-RUN a2enmod 
+RUN a2enmod xsendfile
 
 # install php packages
 COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
diff --git a/docker/containers/web-server/apache/sites-enabled/vhost_app.conf b/docker/containers/web-server/apache/sites-enabled/vhost_app.conf
index 34b4d1e..6d6e7fb 100644
--- a/docker/containers/web-server/apache/sites-enabled/vhost_app.conf
+++ b/docker/containers/web-server/apache/sites-enabled/vhost_app.conf
@@ -1,5 +1,5 @@
 #
-# GENERATED BY init.sh - template: ./templates/vhost_app.conf - 5809b7f8d1f4882c4f3569c9ea042045
+# GENERATED BY init.sh - template: ./templates/vhost_app.conf - 4dfd63417ad808a5ed00ffaf117464a8
 #
 <VirtualHost *:80>
   DocumentRoot /var/www/ci-pkg/public_html
@@ -12,6 +12,9 @@
   # redirect requests to handle packages
   <Location "/packages">
 
+    # for Php as php-fpm service:
+    # SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
+
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php [QSA,L]
@@ -20,7 +23,7 @@
 
   # download files are outside webroot
   XSendFile On
-  XSendFilePath "/var/www/${APP_NAME}/example-packages/"
+  XSendFilePath "/var/www/ci-pkg/example-packages/"
 
   # example to prevent access with http
   <Location "/no-access">
diff --git a/docker/init.sh.cfg b/docker/init.sh.cfg
index 6202716..b96727e 100644
--- a/docker/init.sh.cfg
+++ b/docker/init.sh.cfg
@@ -15,7 +15,7 @@ APP_PORT=8001
 APP_APT_PACKAGES="git unzip zip libapache2-mod-xsendfile"
 
 #APP_APACHE_MODULES="rewrite"
-APP_APACHE_MODULES=""
+APP_APACHE_MODULES="xsendfile"
 
 APP_PHP_VERSION=8.2
 # APP_PHP_MODULES="curl pdo_mysql mbstring xml zip xdebug"
diff --git a/docker/templates/vhost_app.conf b/docker/templates/vhost_app.conf
index 56ce042..7dcadad 100644
--- a/docker/templates/vhost_app.conf
+++ b/docker/templates/vhost_app.conf
@@ -24,7 +24,7 @@
 
   # download files are outside webroot
   XSendFile On
-  XSendFilePath "/var/www/${APP_NAME}/example-packages/"
+  XSendFilePath "/var/www/{{APP_NAME}}/example-packages/"
 
   # example to prevent access with http
   <Location "/no-access">
-- 
GitLab