From afa7b7fc00d886a11ea45b63cdd82c464f5d0284 Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Thu, 29 Apr 2021 12:21:05 +0200 Subject: [PATCH] overhaul webserver: use rootless, simplify apache conf --- .drone.yml | 4 ++-- 000-default.conf | 24 ------------------------ Dockerfile | 10 +++------- publiccode.eu.conf | 13 +++++++++++++ site/static/.htaccess | 3 +++ 5 files changed, 21 insertions(+), 33 deletions(-) delete mode 100644 000-default.conf create mode 100644 publiccode.eu.conf diff --git a/.drone.yml b/.drone.yml index 2e0cf15..956c1ec 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,9 +18,9 @@ steps: validate: true - name: deploy - image: docker/compose:1.24.0 + image: docker/compose:1.29.1 commands: - - docker-compose up --build -d + - docker-compose -p pmpc-website up --build -d volumes: - name: dockersock path: /var/run/docker.sock diff --git a/000-default.conf b/000-default.conf deleted file mode 100644 index b8bc11d..0000000 --- a/000-default.conf +++ /dev/null @@ -1,24 +0,0 @@ - - ServerName www.publiccode.eu - Redirect permanent / https://publiccode.eu/ - - - - ServerName publiccode.eu - - RedirectMatch permanent "^/zh_tw/?(.*)$" "/zh-tw/$1" - - ServerAdmin contact@fsfe.org - DocumentRoot /var/www/html - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - - Options FollowSymLinks Includes - AllowOverride All - Order allow,deny - Allow from all - - - diff --git a/Dockerfile b/Dockerfile index 3cb749c..04d5abd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,5 @@ -FROM php:7-apache +FROM bitnami/apache:2.4 -COPY site/public/ /var/www/html +COPY site/public/ /app/ -COPY 000-default.conf /etc/apache2/sites-enabled/ - -RUN a2enmod rewrite - -CMD apache2-foreground +COPY publiccode.eu.conf /vhosts/ diff --git a/publiccode.eu.conf b/publiccode.eu.conf new file mode 100644 index 0000000..60683ef --- /dev/null +++ b/publiccode.eu.conf @@ -0,0 +1,13 @@ + + ServerName publiccode.eu + + ServerAdmin contact@fsfe.org + DocumentRoot /app + + + Options FollowSymLinks Includes + AllowOverride All + Require all granted + + + diff --git a/site/static/.htaccess b/site/static/.htaccess index 80adf14..68fbb8a 100644 --- a/site/static/.htaccess +++ b/site/static/.htaccess @@ -1,6 +1,9 @@ RewriteEngine On RewriteBase / +# redirect wrong language code we used before +RewriteRule ^zh_tw/?(.*)$ /zh-tw/$1 [L,R=301] + # redirect all requests to non-existing translations to EN RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d