prak3-scripts/LunaLovegood/14.sh

56 lines
1.5 KiB
Bash

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