From eb0ef58d961385ac61a227c49a46592ff449acba Mon Sep 17 00:00:00 2001 From: Keanu Taufan Date: Thu, 3 Oct 2024 21:32:26 +0700 Subject: [PATCH] task 20 --- BrokoliWebServer/20.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 BrokoliWebServer/20.sh diff --git a/BrokoliWebServer/20.sh b/BrokoliWebServer/20.sh new file mode 100644 index 0000000..6ffca89 --- /dev/null +++ b/BrokoliWebServer/20.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +cat > /etc/apache2/sites-available/vitamin.conf < + ServerName vitamin.brokoli.f01.com + ServerAlias www.vitamin.brokoli.f01.com + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/vitamin.brokoli.f01 + + + Options +Indexes + + + + Options +Indexes + + + + Options +FollowSymLinks -Multiviews + AllowOverride All + + + Alias "/img" "/var/www/vitamin.brokoli.f01/public/images" + + RewriteEngine On + + RewriteCond %{REQUEST_URI} ^/img/.*vitamin.*\.(jpg|jpeg|png|gif)$ [NC,OR] + RewriteCond %{REQUEST_URI} ^/public/images/.*vitamin.*\.(jpg|jpeg|png|gif)$ [NC] + RewriteRule .* /public/images/vitamin.png [L] + + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + +EOL + +service apache2 reload \ No newline at end of file