task 9-11

This commit is contained in:
Keanu Taufan 2024-10-03 14:05:20 +07:00
parent c7fa3d33cb
commit 8285b2afb5
No known key found for this signature in database
GPG Key ID: 1952D665A3A51BE0
14 changed files with 272 additions and 2 deletions

35
BayamWebServer/09.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
curl -o web.zip https://fs.taufan.dev/public/jarkom/sayur_webserver_nginx.zip
unzip web.zip
mv sayur_webserver_nginx /var/www/sayur
service nginx start
service php7.2-fpm start
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
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.2-fpm.sock;
}
}
EOL
nginx -s reload

9
BayamWebServer/10.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
mv /var/www/sayur/resep1.php /var/www/sayur/resep_1.php
mv /var/www/sayur/resep2.php /var/www/sayur/resep_2.php
mv /var/www/sayur/resep3.php /var/www/sayur/resep_3.php
sed -i 's/Bayam/BayamWebServer/g' /var/www/sayur/index.php
sed -i 's/Buncis/BuncisWebServer/g' /var/www/sayur/index.php
sed -i 's/Brokoli/BrokoliWebServer/g' /var/www/sayur/index.php

41
BayamWebServer/11.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/bash
cat > /etc/nginx/conf.d/jarkom_log.conf <<EOL
map \$hostname \$modified_hostname {
"BayamWebServer" "Bayam";
"BrokoliWebServer" "Brokoli";
"BuncisWebServer" "Buncis";
}
log_format jarkom_log '[\$time_local] Jarkom Node \$modified_hostname Access from \$remote_addr '
'using method "\$request_method \$request_uri \$server_protocol" '
'returned status \$status with \$body_bytes_sent bytes sent in \$request_time seconds';
EOL
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log jarkom_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.2-fpm.sock;
}
}
EOL
nginx -s reload

5
BayamWebServer/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.2-fpm nginx -y

35
BrokoliWebServer/09.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
curl -o web.zip https://fs.taufan.dev/public/jarkom/sayur_webserver_nginx.zip
unzip web.zip
mv sayur_webserver_nginx /var/www/sayur
service nginx start
service php7.2-fpm start
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
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.2-fpm.sock;
}
}
EOL
nginx -s reload

9
BrokoliWebServer/10.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
mv /var/www/sayur/resep1.php /var/www/sayur/resep_1.php
mv /var/www/sayur/resep2.php /var/www/sayur/resep_2.php
mv /var/www/sayur/resep3.php /var/www/sayur/resep_3.php
sed -i 's/Bayam/BayamWebServer/g' /var/www/sayur/index.php
sed -i 's/Buncis/BuncisWebServer/g' /var/www/sayur/index.php
sed -i 's/Brokoli/BrokoliWebServer/g' /var/www/sayur/index.php

41
BrokoliWebServer/11.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/bash
cat > /etc/nginx/conf.d/jarkom_log.conf <<EOL
map \$hostname \$modified_hostname {
"BayamWebServer" "Bayam";
"BrokoliWebServer" "Brokoli";
"BuncisWebServer" "Buncis";
}
log_format jarkom_log '[\$time_local] Jarkom Node \$modified_hostname Access from \$remote_addr '
'using method "\$request_method \$request_uri \$server_protocol" '
'returned status \$status with \$body_bytes_sent bytes sent in \$request_time seconds';
EOL
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log jarkom_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.2-fpm.sock;
}
}
EOL
nginx -s reload

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.2-fpm nginx -y

35
BuncisWebServer/09.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
curl -o web.zip https://fs.taufan.dev/public/jarkom/sayur_webserver_nginx.zip
unzip web.zip
mv sayur_webserver_nginx /var/www/sayur
service nginx start
service php7.2-fpm start
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
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.2-fpm.sock;
}
}
EOL
nginx -s reload

9
BuncisWebServer/10.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
mv /var/www/sayur/resep1.php /var/www/sayur/resep_1.php
mv /var/www/sayur/resep2.php /var/www/sayur/resep_2.php
mv /var/www/sayur/resep3.php /var/www/sayur/resep_3.php
sed -i 's/Bayam/BayamWebServer/g' /var/www/sayur/index.php
sed -i 's/Buncis/BuncisWebServer/g' /var/www/sayur/index.php
sed -i 's/Brokoli/BrokoliWebServer/g' /var/www/sayur/index.php

41
BuncisWebServer/11.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/bash
cat > /etc/nginx/conf.d/jarkom_log.conf <<EOL
map \$hostname \$modified_hostname {
"BayamWebServer" "Bayam";
"BrokoliWebServer" "Brokoli";
"BuncisWebServer" "Buncis";
}
log_format jarkom_log '[\$time_local] Jarkom Node \$modified_hostname Access from \$remote_addr '
'using method "\$request_method \$request_uri \$server_protocol" '
'returned status \$status with \$body_bytes_sent bytes sent in \$request_time seconds';
EOL
cat > /etc/nginx/conf.d/sayur.conf <<EOL
server {
listen 80;
listen [::]:80;
root /var/www/sayur;
index index.php;
server_name brokoli.f01.com www.brokoli.f01.com buncis.f01.com www.buncis.f01.com bayam.f01.com www.bayam.f01.com;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log jarkom_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.2-fpm.sock;
}
}
EOL
nginx -s reload

5
BuncisWebServer/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.2-fpm nginx -y

View File

@ -2,6 +2,6 @@
echo "nameserver 192.168.122.1" > /etc/resolv.conf echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update apt-get update
apt-get install dnsutils -y apt-get install dnsutils lynx -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf echo "nameserver 10.67.3.3" > /etc/resolv.conf

View File

@ -2,6 +2,6 @@
echo "nameserver 192.168.122.1" > /etc/resolv.conf echo "nameserver 192.168.122.1" > /etc/resolv.conf
apt-get update apt-get update
apt-get install dnsutils -y apt-get install dnsutils lynx -y
echo "nameserver 10.67.3.3" > /etc/resolv.conf echo "nameserver 10.67.3.3" > /etc/resolv.conf