#!/bin/bash ######系統配合 #下載ISO檔 #https://ftp.ubuntu-tw.org/ubuntu-releases/26.04.1/ 安裝 ######鄭亮星 jls@mail.jls.idv.tw , jls550225@gmail.com , jls@acfs.tw ####安裝 Laravel ETH0=$(ls /proc/net/dev_snmp6 |awk '{ print $1 }' |sed -n '1p') IP=$(ifconfig $ETH0 |grep 'inet ' |awk '{print $2}') DOMAINNAME=$(/bin/hostname -d) DATE=$(date "+%Y%m%d%H") curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/bin/composer sudo chmod +x /usr/bin/composer cd /var/www #git clone https://github.com/laravel/laravel.git composer create-project laravel/laravel --prefer-dist chown www-data:www-data laravel -R cd laravel chmod -R 777 storage chmod -R 777 bootstrap/cache cp -arf /etc/bind/$DOMAINNAME /etc/bind/$DOMAINNAME-$DATE cat >> /etc/bind/$DOMAINNAME << EOF laravel IN A $IP EOF cp -arf /etc/apache2/sites-available/http_80.conf /etc/apache2/sites-available/http_80.conf-$DATE cat >> /etc/apache2/sites-available/http_80.conf << EOF #------------------------------------------------------------------------------------------------------------------------ ServerAdmin root@$DOMAINNAME DocumentRoot /var/www/laravel/public ServerName laravel.$DOMAINNAME DirectoryIndex index.html index.php index.htm index.php3 # #### From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server # SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost" # # CBandSpeed 40960 200 200 # CBandRemoteSpeed 40960kb/s 100 100 # CBandLimit 10000Mb # CBandPeriod 4W # CBandScoreboard /var/log/scoreboard/laravel.$DOMAINNAME # CBandScoreFlushPeriod /var/log/scoreboard/laravel.$DOMAINNAME # CBandExceededURL http://$DOMAINNAME/cband_error.html EOF cp -arf /etc/apache2/sites-available/https_443.conf /etc/apache2/sites-available/https_443.conf-$DATE cat >> /etc/apache2/sites-available/https_443.conf << EOF #------------------------------------------------------------------------------------------------------------------------ ServerAdmin root@$DOMAINNAME DocumentRoot /var/www/laravel/public ServerName laravel.$DOMAINNAME DirectoryIndex index.html index.php index.htm index.php3 # #### From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server # SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost" # # CBandSpeed 40960 200 200 # CBandRemoteSpeed 40960kb/s 100 100 # CBandLimit 10000Mb # CBandPeriod 4W # CBandScoreboard /var/log/scoreboard/laravel.$DOMAINNAME # CBandScoreFlushPeriod /var/log/scoreboard/laravel.$DOMAINNAME # CBandExceededURL https://$DOMAINNAME/cband_error.html EOF #sudo composer install systemctl restart named.service # systemctl restart php8.3-fpm.service systemctl restart apache2.service