prak2-scripts/BayamWebServer/11.sh
2024-10-03 14:05:20 +07:00

41 lines
1.0 KiB
Bash

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