prak3-scripts/ChoChang/19.sh
2024-10-24 21:28:49 +07:00

59 lines
1.3 KiB
Bash

#!/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