task 1-17 excluding 8 and 10

This commit is contained in:
Keanu Taufan 2024-10-24 16:41:16 +07:00
commit 1b4bbe712e
No known key found for this signature in database
GPG Key ID: 1952D665A3A51BE0
37 changed files with 841 additions and 0 deletions

3
ChoChang/13.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
mysql --host=10.67.4.2 --user=kelompokf01 --password=passwordf01

55
ChoChang/14.sh Normal file
View File

@ -0,0 +1,55 @@
#!/bin/bash
git clone https://github.com/lodaogos/laravel-jarkom-modul-3.git
mv laravel-jarkom-modul-3 /var/www
cp /var/www/laravel-jarkom-modul-3/.env.example /var/www/laravel-jarkom-modul-3/.env
chown -R www-data.www-data /var/www/laravel-jarkom-modul-3/storage
sed -i 's/DB_HOST=127.0.0.1/DB_HOST=10.67.4.2/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_DATABASE=laravel/DB_DATABASE=dbkelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_USERNAME=root/DB_USERNAME=kelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_PASSWORD=/DB_PASSWORD=passwordf01/g' /var/www/laravel-jarkom-modul-3/.env
service nginx start
service php8.0-fpm start
cd /var/www/laravel-jarkom-modul-3 && \
composer update && \
composer install && \
php artisan migrate:fresh && \
php artisan db:seed --class=MusicsTableSeeder && \
php artisan key:generate && \
php artisan jwt:secret
cat > /etc/nginx/sites-available/default <<EOL
server {
listen 80;
listen [::]:80;
server_name _;
root /var/www/laravel-jarkom-modul-3/public;
index index.php index.html index.htm;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
nginx -s reload

17
ChoChang/setup.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install software-properties-common mariadb-client -y
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y
apt-get install nginx git -y
wget https://getcomposer.org/download/2.0.13/composer.phar
chmod +x composer.phar
mv composer.phar /usr/bin/composer
echo "nameserver 10.67.3.3" > /etc/resolv.conf

4
DracoMalfoy/07.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# Run 3 times
ab -n 1000 -c 100 http://gryffindor.hogwarts.f01.com/

7
DracoMalfoy/setup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install apache2-utils -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf

13
Dumbledore/02.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
cat > /etc/default/isc-dhcp-relay <<EOL
SERVERS="10.67.3.2"
INTERFACES="eth1 eth2 eth3 eth4 eth5 eth6"
OPTIONS=
EOL
cat > /etc/sysctl.conf <<EOL
net.ipv4.ip_forward=1
EOL
service isc-dhcp-relay restart

6
Dumbledore/setup.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE -s 10.67.0.0/16
apt-get update
apt-get install isc-dhcp-relay -y

3
FiliusFlitwick/13.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
mysql --host=10.67.4.2 --user=kelompokf01 --password=passwordf01

54
FiliusFlitwick/14.sh Normal file
View File

@ -0,0 +1,54 @@
#!/bin/bash
git clone https://github.com/lodaogos/laravel-jarkom-modul-3.git
mv laravel-jarkom-modul-3 /var/www
cp /var/www/laravel-jarkom-modul-3/.env.example /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_HOST=127.0.0.1/DB_HOST=10.67.4.2/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_DATABASE=laravel/DB_DATABASE=dbkelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_USERNAME=root/DB_USERNAME=kelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_PASSWORD=/DB_PASSWORD=passwordf01/g' /var/www/laravel-jarkom-modul-3/.env
service nginx start
service php8.0-fpm start
cd /var/www/laravel-jarkom-modul-3 && \
composer update && \
composer install && \
php artisan migrate:fresh && \
php artisan db:seed --class=MusicsTableSeeder && \
php artisan key:generate && \
php artisan jwt:secret
cat > /etc/nginx/sites-available/default <<EOL
server {
listen 80;
listen [::]:80;
server_name _;
root /var/www/laravel-jarkom-modul-3/public;
index index.php index.html index.htm;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
nginx -s reload

15
FiliusFlitwick/setup.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install software-properties-common mariadb-client -y
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y
apt-get install nginx git -y
wget https://getcomposer.org/download/2.0.13/composer.phar
chmod +x composer.phar
mv composer.phar /usr/bin/composer

38
Hagrid/13.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
service mysql start
if [ $(echo "SELECT COUNT(*) FROM mysql.user WHERE user = 'kelompokf01';" | mysql | tail -n1) -eq 0 ]
then
cat > inituser.sql <<EOL
CREATE USER 'kelompokf01'@'%' IDENTIFIED BY 'passwordf01';
CREATE USER 'kelompokf01'@'localhost' IDENTIFIED BY 'passwordf01';
EOL
mysql < inituser.sql
fi
cat > inituser.sql <<EOL
CREATE DATABASE dbkelompokf01;
GRANT ALL PRIVILEGES ON *.* TO 'kelompokf01'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'kelompokf01'@'10.67.6.4';
GRANT ALL PRIVILEGES ON *.* TO 'kelompokf01'@'10.67.6.3';
GRANT ALL PRIVILEGES ON *.* TO 'kelompokf01'@'10.67.6.14';
GRANT ALL PRIVILEGES ON *.* TO 'kelompokf01'@'localhost';
FLUSH PRIVILEGES;
EOL
mysql < inituser.sql
cat > /etc/mysql/my.cnf <<EOL
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
skip-networking=0
skip-bind-address
EOL
rm inituser.sql
service mysql restart

5
Hagrid/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install mariadb-server -y

35
HarryPotter/06.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip
unzip -d worker web.zip
mv worker /var/www
service nginx start
service php7.4-fpm start
cat > /etc/nginx/sites-enabled/default <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/worker;
index index.php index.html index.htm;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string =404;
}
location ~ \.php\$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
EOL
nginx -s reload

5
HarryPotter/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install unzip php7.4-fpm nginx -y

37
HermioneGranger/06.sh Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip
unzip -d worker web.zip
mv worker /var/www
echo "nameserver 10.67.3.3" > /etc/resolv.conf
service nginx start
service php7.4-fpm start
cat > /etc/nginx/sites-enabled/default <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/worker;
index index.php index.html index.htm;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string =404;
}
location ~ \.php\$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
EOL
nginx -s reload

7
HermioneGranger/setup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install unzip php7.4-fpm nginx -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf

3
LunaLovegood/13.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
mysql --host=10.67.4.2 --user=kelompokf01 --password=passwordf01

54
LunaLovegood/14.sh Normal file
View File

@ -0,0 +1,54 @@
#!/bin/bash
git clone https://github.com/lodaogos/laravel-jarkom-modul-3.git
mv laravel-jarkom-modul-3 /var/www
cp /var/www/laravel-jarkom-modul-3/.env.example /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_HOST=127.0.0.1/DB_HOST=10.67.4.2/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_DATABASE=laravel/DB_DATABASE=dbkelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_USERNAME=root/DB_USERNAME=kelompokf01/g' /var/www/laravel-jarkom-modul-3/.env
sed -i 's/DB_PASSWORD=/DB_PASSWORD=passwordf01/g' /var/www/laravel-jarkom-modul-3/.env
service nginx start
service php8.0-fpm start
cd /var/www/laravel-jarkom-modul-3 && \
composer update && \
composer install && \
php artisan migrate:fresh && \
php artisan db:seed --class=MusicsTableSeeder && \
php artisan key:generate && \
php artisan jwt:secret
cat > /etc/nginx/sites-available/default <<EOL
server {
listen 80;
listen [::]:80;
server_name _;
root /var/www/laravel-jarkom-modul-3/public;
index index.php index.html index.htm;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
nginx -s reload

15
LunaLovegood/setup.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install software-properties-common mariadb-client -y
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y
apt-get install nginx git -y
wget https://getcomposer.org/download/2.0.13/composer.phar
chmod +x composer.phar
mv composer.phar /usr/bin/composer

44
McGonagall/01.sh Normal file
View File

@ -0,0 +1,44 @@
#/bin/bash
cat > /etc/bind/named.conf.options <<EOL
options {
directory "/var/cache/bind";
forwarders {
192.168.122.1;
};
dnssec-validation no;
auth-nxdomain no;
allow-query { any; };
listen-on-v6 { any; };
};
EOL
cat > /etc/bind/named.conf.local <<EOL
zone "hogwarts.f01.com" {
type master;
file "/etc/bind/hogwarts/hogwarts.f01.com";
};
EOL
mkdir -p /etc/bind/hogwarts
cat > /etc/bind/hogwarts/hogwarts.f01.com <<EOL
\$TTL 604800
@ IN SOA ns1.hogwarts.f01.com. root.hogwarts.f01.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ); Negative Cache TTL
@ IN NS ns1.hogwarts.f01.com.
ns1 IN A 10.67.3.3 ; IP address of DNS Master
gryffindor IN A 10.67.4.3 ; IP address of Voldemort LB
ravenclaw IN A 10.67.4.4 ; IP address of Dementor LB
EOL
service named restart

5
McGonagall/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install bind9 -y

35
RonWeasley/06.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip
unzip -d worker web.zip
mv worker /var/www
service nginx start
service php7.4-fpm start
cat > /etc/nginx/sites-enabled/default <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/worker;
index index.php index.html index.htm;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files \$uri \$uri/ /index.php?\$query_string =404;
}
location ~ \.php\$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
EOL
nginx -s reload

5
RonWeasley/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install unzip php7.4-fpm nginx -y

31
SeverusSnape/02.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
cat > /etc/default/isc-dhcp-server <<EOL
INTERFACESv4="eth0"
EOL
cat > /etc/dhcp/dhcpd.conf <<EOL
subnet 10.67.2.0 netmask 255.255.255.0 {
range 10.67.2.64 10.67.2.65;
range 10.67.2.100 10.67.2.101;
option routers 10.67.2.1;
option broadcast-address 10.67.2.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
subnet 10.67.5.0 netmask 255.255.255.0 {
range 10.67.5.50 10.67.5.51;
range 10.67.5.155 10.67.5.156;
option routers 10.67.5.1;
option broadcast-address 10.67.5.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
subnet 10.67.3.0 netmask 255.255.255.0 {}
EOL
service isc-dhcp-server restart

46
SeverusSnape/03.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
cat > /etc/dhcp/dhcpd.conf <<EOL
subnet 10.67.2.0 netmask 255.255.255.0 {
range 10.67.2.64 10.67.2.65;
range 10.67.2.100 10.67.2.101;
option routers 10.67.2.1;
option broadcast-address 10.67.2.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
subnet 10.67.5.0 netmask 255.255.255.0 {
range 10.67.5.50 10.67.5.51;
range 10.67.5.155 10.67.5.156;
option routers 10.67.5.1;
option broadcast-address 10.67.5.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
subnet 10.67.3.0 netmask 255.255.255.0 {}
subnet 10.67.1.0 netmask 255.255.255.0 {
range 10.67.1.10 10.67.1.15;
range 10.67.1.20 10.67.1.25;
option routers 10.67.1.1;
option broadcast-address 10.67.1.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
subnet 10.67.6.0 netmask 255.255.255.0 {
range 10.67.6.10 10.67.6.15;
range 10.67.6.20 10.67.6.25;
option routers 10.67.6.1;
option broadcast-address 10.67.6.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6900;
}
EOL
service isc-dhcp-server restart

47
SeverusSnape/04.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
cat > /etc/dhcp/dhcpd.conf <<EOL
subnet 10.67.2.0 netmask 255.255.255.0 {
range 10.67.2.64 10.67.2.65;
range 10.67.2.100 10.67.2.101;
option routers 10.67.2.1;
option broadcast-address 10.67.2.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6000;
}
subnet 10.67.5.0 netmask 255.255.255.0 {
range 10.67.5.50 10.67.5.51;
range 10.67.5.155 10.67.5.156;
option routers 10.67.5.1;
option broadcast-address 10.67.5.255;
option domain-name-servers 10.67.3.3;
default-lease-time 1200;
max-lease-time 6000;
}
subnet 10.67.3.0 netmask 255.255.255.0 {}
subnet 10.67.1.0 netmask 255.255.255.0 {
range 10.67.1.10 10.67.1.15;
range 10.67.1.20 10.67.1.25;
option routers 10.67.1.1;
option broadcast-address 10.67.1.255;
option domain-name-servers 10.67.3.3;
default-lease-time 600;
max-lease-time 6000;
}
subnet 10.67.6.0 netmask 255.255.255.0 {
range 10.67.6.10 10.67.6.15;
range 10.67.6.20 10.67.6.25;
option routers 10.67.6.1;
option broadcast-address 10.67.6.255;
option domain-name-servers 10.67.3.3;
default-lease-time 600;
max-lease-time 6000;
}
EOL
service isc-dhcp-server restart

57
SeverusSnape/05.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/bash
cat > /etc/dhcp/dhcpd.conf <<EOL
subnet 10.67.2.0 netmask 255.255.255.0 {
range 10.67.2.64 10.67.2.65;
range 10.67.2.100 10.67.2.101;
option routers 10.67.2.1;
option broadcast-address 10.67.2.255;
option domain-name-servers 10.67.3.3;
default-lease-time 300;
max-lease-time 6000;
}
subnet 10.67.5.0 netmask 255.255.255.0 {
range 10.67.5.50 10.67.5.51;
range 10.67.5.155 10.67.5.156;
option routers 10.67.5.1;
option broadcast-address 10.67.5.255;
option domain-name-servers 10.67.3.3;
default-lease-time 1200;
max-lease-time 6000;
}
subnet 10.67.3.0 netmask 255.255.255.0 {}
subnet 10.67.1.0 netmask 255.255.255.0 {
range 10.67.1.10 10.67.1.15;
range 10.67.1.20 10.67.1.25;
option routers 10.67.1.1;
option broadcast-address 10.67.1.255;
option domain-name-servers 10.67.3.3;
default-lease-time 600;
max-lease-time 6000;
}
subnet 10.67.6.0 netmask 255.255.255.0 {
range 10.67.6.10 10.67.6.15;
range 10.67.6.20 10.67.6.25;
option routers 10.67.6.1;
option broadcast-address 10.67.6.255;
option domain-name-servers 10.67.3.3;
default-lease-time 600;
max-lease-time 6000;
}
host HermioneGranger {
hardware ethernet aa:bb:cc:01:01:01;
fixed-address 10.67.1.14;
}
host ChoChang {
hardware ethernet aa:bb:cc:06:06:06;
fixed-address 10.67.6.14;
}
EOL
service isc-dhcp-server restart

7
SeverusSnape/setup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install isc-dhcp-server -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf

5
SusanBones/15.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo '{"username":"f01","password":"f01f01"}' > temp.json
ab -n 100 -c 10 -T application/json -p temp.json http://10.67.6.4/api/auth/register
rm temp.json

5
SusanBones/16.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo '{"username":"f01","password":"f01f01"}' > temp.json
ab -n 100 -c 10 -T application/json -p temp.json -v 4 http://10.67.6.4/api/auth/login
rm temp.json

7
SusanBones/17.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ "$1" ]; then
ab -n 100 -c 10 -T application/json -H "Authorization: Bearer $1" -v 4 http://10.67.6.4/api/me
else
echo "Please provide authorization token as the argument"
fi

7
SusanBones/setup.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install apache2-utils -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf

30
Voldemort/07.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
service nginx start
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
server 10.67.1.2; # IP HarryPotter
server 10.67.1.3; # IP RonWeasley
server 10.67.1.14; # IP HermioneGranger (setelah nomor 5)
}
server {
listen 80;
listen [::]:80;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://backend;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
}
}
EOL
nginx -s reload

33
Voldemort/09.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
htpasswd -bc /etc/nginx/secretchamber jarkom modul3
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
server 10.67.1.2; # IP HarryPotter
server 10.67.1.3; # IP RonWeasley
server 10.67.1.14; # IP HermioneGranger (setelah nomor 5)
}
server {
listen 80;
listen [::]:80;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
auth_basic "Secure Area";
auth_basic_user_file /etc/nginx/secretchamber;
location / {
proxy_pass http://backend;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
}
}
EOL
nginx -s reload

45
Voldemort/11.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
server 10.67.1.2; # IP HarryPotter
server 10.67.1.3; # IP RonWeasley
server 10.67.1.14; # IP HermioneGranger (setelah nomor 5)
}
server {
listen 80;
listen [::]:80;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
auth_basic "Secure Area";
auth_basic_user_file /etc/nginx/secretchamber;
location / {
proxy_pass http://backend;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
}
location ~* /informatika$ {
proxy_pass https://www.its.ac.id;
rewrite ^.*$ /informatika/id/beranda/ break;
proxy_set_header Host www.its.ac.id;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
}
}
EOL
nginx -s reload

51
Voldemort/12.sh Normal file
View File

@ -0,0 +1,51 @@
#!/bin/bash
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
server 10.67.1.2; # IP HarryPotter
server 10.67.1.3; # IP RonWeasley
server 10.67.1.14; # IP HermioneGranger (setelah nomor 5)
}
server {
listen 80;
listen [::]:80;
server_name _;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
allow 10.67.2.64;
allow 10.67.2.100;
allow 10.67.5.50;
allow 10.67.5.155;
deny all;
auth_basic "Secure Area";
auth_basic_user_file /etc/nginx/secretchamber;
location / {
proxy_pass http://backend;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
}
location ~* /informatika$ {
proxy_pass https://www.its.ac.id;
rewrite ^.*$ /informatika/id/beranda/ break;
proxy_set_header Host www.its.ac.id;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
}
}
EOL
nginx -s reload

5
Voldemort/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update
apt-get install nginx apache2-utils -y