This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/attic-docker.git
The following commit(s) were added to refs/heads/main by this push:
new da22918 Add CGI page processing
da22918 is described below
commit da22918d4c512639ce9b8aa859d592d0300fc190
Author: Sebb <[email protected]>
AuthorDate: Wed Jan 22 22:29:55 2025 +0000
Add CGI page processing
---
Dockerfile | 3 ++-
README.md | 12 +++++++++++-
compose.yaml | 5 ++++-
config/000-default.conf | 29 ++++++++++++++++++++++++-----
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 0bdff57..e5fe3d3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,7 +17,8 @@ RUN DEBIAN_FRONTEND='noninteractive' apt-get install -y \
RUN a2enmod cgi && \
a2enmod lua && \
- a2enmod headers
+ a2enmod headers && \
+ a2enmod rewrite
COPY config/000-default.conf /etc/apache2/sites-enabled/000-default.conf
COPY config/attic_filter.lua /etc/apache2/conf-enabled/attic_filter.lua
diff --git a/README.md b/README.md
index ad68bc5..1dce3ec 100644
--- a/README.md
+++ b/README.md
@@ -18,10 +18,20 @@ To enable/disable the Attic banner, create/delete the
directory:
To enable/disable Content-Security-Policy, create/delete the directory:
/path/to/website/_CSP
+To process download cgi pages, you will need access to
+the closer_cgi/files directory in the private infrasture-p6 repository.
+If not available, such pages will fail to load, but the site should otherwise
work OK.
+
Start:
-VAR_HTML=/path/to/website docker compose up
+[VAR_DYN=/path/to/closer_cgi/files] VAR_HTML=/path/to/website docker compose up
browse to localhost:8000
Start shell (container must be running)
docker compose exec attic_lua_csp /bin/bash
+
+Restart httpd server
+docker compose exec attic_lua_csp apachectl restart
+
+Stop httpd server (and the container)
+docker compose exec attic_lua_csp apachectl stop
diff --git a/compose.yaml b/compose.yaml
index 71f4078..7628999 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -5,5 +5,8 @@ services:
ports:
- "8000:80"
volumes:
- - ${VAR_HTML:-./www}:/var/www
+ # Pick up the Lua scripts etc
+ - ${VAR_DYN:-.}:/var/www/dyn
+ # Needs to match xxx.apache.org or closer.lua reverts to default template
+ - ${VAR_HTML:-./www}:/var/www/site.apache.org
- ${VAR_LOG:-./log}:/var/log/apache2
diff --git a/config/000-default.conf b/config/000-default.conf
index ed9d4f3..343541c 100644
--- a/config/000-default.conf
+++ b/config/000-default.conf
@@ -1,13 +1,32 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
- ServerName attic_lua
- DocumentRoot /var/www
+ # This is mapped at run-time
+ DocumentRoot /var/www/site.apache.org
LuaScope thread
LuaCodeCache stat
- <If "-d '/var/www/_CSP'">
+ # CGI handling
+ RewriteEngine On
+ RewriteOptions InheritDown
+ # the f variable must not contain //; it appears that DOCUMENT_ROOT
terminates with /
+ RewriteRule .*\.cgi
/var/www/dyn/closer.lua?f=%{DOCUMENT_ROOT}%{REQUEST_FILENAME} [QSA,L]
+ RewriteRule ^/dyn/closer\.lua
/var/www/dyn/closer.lua?f=%{DOCUMENT_ROOT}%{REQUEST_FILENAME} [QSA,L]
+ RewriteRule ^/dyn/closer_still\.lua
/var/www/dyn/closer_still.lua?f=%{DOCUMENT_ROOT}%{REQUEST_FILENAME} [QSA,L]
+ # This is mapped at run-time
+ <Directory /var/www/dyn/>
+ Require all granted
+ <FilesMatch "closer\.lua">
+ SetHandler lua-script
+ </FilesMatch>
+ <FilesMatch "closer_still\.lua">
+ SetHandler lua-script
+ </FilesMatch>
+ </Directory>
+
+
+ <If "-d '/var/www/site.apache.org/_CSP'">
Header set Content-Security-Policy "default-src 'self' \
data: 'unsafe-inline' https://www.apachecon.com/
https://www.communityovercode.org/ https://analytics.apache.org/; \
script-src 'self' 'unsafe-inline' 'unsafe-eval'
https://analytics.apache.org/; \
@@ -17,8 +36,8 @@
# Filter website to add Attic header if marker directory is present
LuaOutputFilter attic "/etc/apache2/conf-enabled/attic_filter.lua"
output_filter
- <If "-d '/var/www/_ATTIC'">
- AddOutputFilter attic html
+ <If "-d '/var/www/site.apache.org/_ATTIC'">
+ AddOutputFilter attic html lua
</If>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,