From f0e9a7ef870fab2c07c37420b4635855be81a21b Mon Sep 17 00:00:00 2001 From: Keanu Taufan Date: Thu, 3 Oct 2024 19:42:59 +0700 Subject: [PATCH] task 18 --- BrokoliWebServer/18.sh | 26 ++++++++++++++++++++++++++ BrokoliWebServer/setup.sh | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 BrokoliWebServer/18.sh diff --git a/BrokoliWebServer/18.sh b/BrokoliWebServer/18.sh new file mode 100644 index 0000000..3e2c10d --- /dev/null +++ b/BrokoliWebServer/18.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +a2enmod auth_basic +htpasswd -bc /etc/apache2/.htpasswd Seblak sehatf01 + +cat > /etc/apache2/sites-available/k1.conf < + ServerName k1.vitamin.brokoli.f01.com + ServerAlias www.k1.vitamin.brokoli.f01.com + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/k1.vitamin.brokoli.f01 + + + AuthType Basic + AuthName "Restricted Content" + AuthUserFile /etc/apache2/.htpasswd + Require valid-user + + + ErrorLog \${APACHE_LOG_DIR}/error.log + CustomLog \${APACHE_LOG_DIR}/access.log combined + +EOL + +service apache2 restart \ No newline at end of file diff --git a/BrokoliWebServer/setup.sh b/BrokoliWebServer/setup.sh index 6fee0cd..23c35ab 100644 --- a/BrokoliWebServer/setup.sh +++ b/BrokoliWebServer/setup.sh @@ -2,4 +2,4 @@ echo "nameserver 192.168.122.1" > /etc/resolv.conf apt-get update -apt-get install unzip php7.2 php7.2-fpm apache2 nginx -y \ No newline at end of file +apt-get install unzip php7.2 php7.2-fpm apache2 apache2-utils nginx -y \ No newline at end of file