Compare commits

...

4 Commits

Author SHA1 Message Date
9aeb453743
task 20 2024-10-24 21:31:33 +07:00
f53b43993a
task 19 2024-10-24 21:28:49 +07:00
ef5555948a
fix task 14 permission denied 2024-10-24 21:28:28 +07:00
c0212de1ad
task 18 2024-10-24 20:40:09 +07:00
11 changed files with 258 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
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

59
ChoChang/19.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
groupadd modified_user
useradd -g modified_user modified_user
chown -R modified_user.modified_user /var/www/laravel-jarkom-modul-3/storage
cat > /etc/php/8.0/fpm/pool.d/modified.conf <<EOL
[modified_site]
user = modified_user
group = modified_user
listen = /var/run/php8.0-fpm-modified-site.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 100
pm.process_idle_timeout = 10s
EOL
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/php8.0-fpm-modified-site.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
/etc/init.d/php8.0-fpm restart
service nginx restart

31
Dementor/18.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
service nginx start
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
server 10.67.6.4; # IP LunaLovegood
server 10.67.6.3; # IP FiliusFlitwick
server 10.67.6.14; # IP ChoChang (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_bind 10.67.4.4;
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

30
Dementor/20.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
cat > /etc/nginx/sites-enabled/default <<EOL
upstream backend {
least_conn;
server 10.67.6.4; # IP LunaLovegood
server 10.67.6.3; # IP FiliusFlitwick
server 10.67.6.14; # IP ChoChang (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_bind 10.67.4.4;
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

5
Dementor/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 -y

View File

@ -1,8 +1,10 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
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

59
FiliusFlitwick/19.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
groupadd modified_user
useradd -g modified_user modified_user
chown -R modified_user.modified_user /var/www/laravel-jarkom-modul-3/storage
cat > /etc/php/8.0/fpm/pool.d/modified.conf <<EOL
[modified_site]
user = modified_user
group = modified_user
listen = /var/run/php8.0-fpm-modified-site.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 100
pm.process_idle_timeout = 10s
EOL
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/php8.0-fpm-modified-site.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
/etc/init.d/php8.0-fpm restart
service nginx restart

View File

@ -1,8 +1,10 @@
#!/bin/bash
echo "nameserver 192.168.122.1" > /etc/resolv.conf
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

59
LunaLovegood/19.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
groupadd modified_user
useradd -g modified_user modified_user
chown -R modified_user.modified_user /var/www/laravel-jarkom-modul-3/storage
cat > /etc/php/8.0/fpm/pool.d/modified.conf <<EOL
[modified_site]
user = modified_user
group = modified_user
listen = /var/run/php8.0-fpm-modified-site.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 100
pm.process_idle_timeout = 10s
EOL
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/php8.0-fpm-modified-site.sock;
}
location ~ /\.ht {
deny all;
}
}
EOL
/etc/init.d/php8.0-fpm restart
service nginx restart

5
SusanBones/19.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://ravenclaw.hogwarts.f01.com/api/auth/login
rm temp.json

5
SusanBones/20.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://ravenclaw.hogwarts.f01.com/api/auth/login
rm temp.json