EasyEngine Laravel

How To Install Laravel On EasyEngine

There is not a lot of tutorial on how to setup/install laravel app on a server running EasyEngine
So here I made one 🙂

*Side Note, All the ‘example.com’ and ‘examplecom’ must be change to your domain name!

1 Install EE (Easy Engine)

wget -qO ee rt.cx/ee4 && sudo bash ee

2 Add Our Site

ee site create example.com --type=php --ssl=le --with-db --php=8.0

This command will add “example.com” with database, ssl, and PHP version 8.0
Don’t forget save the site info once the site created

3 Enter Shell

ee shell example.com --user=root

4 Install Laravel #Do This Once

composer global require laravel/installer << Just Do This Once When We Fresh Install EasyEngine, Don't Run For Your Second Or More Project!, Go Straight To step 6

*Just Do This Once When We Fresh Install EasyEngine
Don’t Run For Your Second Or More Project! You Can Go Straight To step 6

5 Configure $PATH for composer

vim ~/.bash_profile 
export PATH=~/.composer/vendor/bin:$PATH << Paste This
source ~/.bash_profile

*Just Do This Once When We Fresh Install Laravel

6 Add Laravel App

laravel new example-app
cd example-app

*This will Install Laravel App Called “example-app”

7 Configure .env

nano .env

Here we must configure our .env file
All the required data you can get from running shell ee site info example.com

APP_URL=https://example.com

...

DB_CONNECTION=mysql
DB_HOST=global-db
DB_PORT=3306
DB_DATABASE=example_com
DB_USERNAME=example.com-QWERTY
DB_PASSWORD=qafNkpWoCUg0

8 Migrate Database

php artisan migrate:fresh
exit

We Exit Shell After Migrate

9 Edit Nginx Root Dir

cd /var/lib/docker/volumes/examplecom_config_nginx/_data/conf.d
nano main.conf

Here we must edit "root /var/www/htdocs;" To "root /var/www/htdocs/example-app/public;"
(example-app) is the laravel app name we created earlier in Step 6
Save The File

10 Chown

chown -R www-data.www-data /var/lib/docker/volumes/examplecom_htdocs/_data/htdocs/example-app/storage
chown -R www-data.www-data /var/lib/docker/volumes/examplecom_htdocs/_data/htdocs/example-app/bootstrap/cache

11 Reload

ee site reload example.com

Done

You can then proceed building your web app like usual!