HESTIA Version: Upload laravel app to  Cpanel host with git.

Example Goal:

  • Backend: Laravel API
    Source: f/apachefriends/xampp/htdocs/over-imgV5/REACT/MYOWN/IONIC/BACKEND-laravel-api-template/laravel-api-uploadV2
  • FrontEnd: ReactJS
    Source: /f/apachefriends/xampp/htdocs/over-imgV5/REACT/Version2/OPENSOURCE/MDB/mdb5
  • Hosting: CGP VM Linux
  • Hosting Panel: Hestia
  • SSH: Putty & WindSCP

Tip: Makes sure the PHP version running in you local development is the same version on your remote server!

LOCAL DEV

  • $ cd HOSTING_FOLDER_NAME
  • $ git init
  • $ git add .
  • $ git commit

Create repo in github and copy the URL of the new REPO.

Github.com - MAKE SURE TO SELECT PRIVATE OR PUBLIC

  • $ git init
  • $ git add .
  • $ git commit -m "202404131945pm initial commit"
  • $ git remote add production https://github.com/USER/repo.git
  • $ git remote -v
  • $ git push production master

Create DNS Records (example: CloudFlare)

https://dash.cloudflare.com/[ID]/domain.com/dns/records

Example: sub.example.com

  • Type = CNAME
  • Name = sub
  • Target = www.example.com

PRODUCTION REMOTE: Hestia Control Panel

Login to Hestia control panel: https://hpc.domain.com:2083/login/

Create a domain sub domain: example.domain.com

  1. Login to Hesta Main Dashboard
  2. Click "AddWeb Domain" Button
  3. Domain: sub.domain.com
  4. Aliases: [blank]
  5. IP Address: 35.x.x.x
  6. Web Statistics: None
  7. ☒ Enable SSL for this domain
  8. ☒ Use Let's Encrypt to obtain SSL Certificate
  9. ☒ Enable HTTP Strict Transport Secuirty (HSTS)
  10. ☒ Save

Access Shell (example: GCP) or Check Putty for Hestia Saved Session

  1. Tutorial on how to access GCP VIM with Putty
  2. Download WindSCP if you need SFTP access
  3. Follow step #5 from: Setup  Secured FTP with SSH and SCP to connect to GCP VM Instance Link Here
  4. Or Open SSH from GCP Dashboard: https://console.cloud.google.com/compute/instances?project=free-tier-xxxxxxx

$ cd /home/edwin/web/secured2.domain.com

$ ls

OUTPUT:

cgi-bin  document_errors  logs  private  public_html  stats

$ cd private
$ mkdir laravelUploadV2
$ cd
laravelUploadV2
$ git init
$ git remote add production https://github.com/[user]/upload_image_v2.git
$ git pull production master
$ username:
$ password: TOKEN [you can find it in my claves expires 4/12/2025]
$ composer install --optimize-autoloader --no-dev

>>>>>>>>>>>>>>>>>>>>>> ERRORS <<<<<<<<<<<<<<<<<<<<<<<<<

Error #1: Your lock file does not contain a compatible set of packages. Please run composer update.

Solution: $ composer update

Try again:

$ composer install --optimize-autoloader --no-dev

It worked!

202404130806pm - Error #2: Your requirements could not be resolved to an installable set of packages.

Root composer.json requires php ^8.1 but your php version (8.0.27) does not satisfy that requirement.

Solution: Login to Hestia Control Panel for the domain and under Advanced, select PHP-8_1

NOTE: To update, i had to reboot. I also did
$ sudo apt-get update
$ sudo apt-get install php

Try again:

$ composer update
$ composer install --optimize-autoloader --no-dev

Mmake copy and open .env to update database infromation

$ mv .env.example .env
$ nano .env or vim .env
APP_NAME
APP_ENV=production
APP_DEBUG=false
APP_URL=https://DOMAIN.COM

DB_CONNECTION

DB_CONNECTION=mysql
DB_HOST=xxxxxxxxxxx
DB_PORT=3306
DB_DATABASE=xxxxxxxx
DB_USERNAME=xxxxxx
DB_PASSWORD=xxxx

For Twilio If any:

# SMS TEXT MESSAGES
TWILIO_SID=xxxxxxxxxx
TWILIO_TOKEN=xxxxxxxx
TWILIO_FROM=+xxxxxxx

[SAVE CHANGES]: esc + Shift : > wq

$ php artisan key:generate
$ php artisan migrate
$ php artisan config:cache
$ php artisan route:cache
$ php artisan view:cache
$ php artisan storage:link
$ cd /home/edwin/web/secured2.DOMAIN.com

Thats done for the private/ folder, now lets open the /public file of laravel into the hosting public folder.

video  t=411

BACKUP Original public_html

$ sudo mv public_html public_html_OG

NOTE: su - Does not work!!

CREATE SYMBOLIC LINK

 

sudo ln -s private/laravelUploadV2/public public_html
sudo chown edwin:www-data private/laravelUploadV2/public>
sudo chown -h edwin:www-data public_html
ls -la

drwxr-x--x 3 edwin edwin    4096 Jun 21 07:30 private
lrwxrwxrwx 1 edwin www-data   22 Jun 22 18:20 public_html -> private/laravelUploadV2/public
drwxr-x--x 2 edwin www-data 4096 Jun 21 07:27 public_html_OG
dr-xr-x--x 2 edwin edwin    4096 Jun 21 07:27 stats

BACKEND DONE: OPEN secured2.DOMAIN.com GOOD LUCK

20-p4980-laravel-9-splash-screen.jpg

LOCAL DEV
ANY CHANGES IN THE LOCAL DEV, just push the new changes to github
/f/apachefriends/xampp/htdocs/over-imgV5/REACT/MYOWN/IONIC/BACKEND-laravel-api-template/laravel-api-upload

$ git push production master

PRODUCTION REMOTE:
~/web/share.[DOMAIN].com/private/laravel/

$ cd HOSTING_FOLDER_NAME
$ php artisan down
$ git pull production master
User: [email protected]
Password: example key location: g/Program Files/winscp/keys/Hestia-SSH/github.txt
$ php artisan optimize
$ php artisan view:cache
$ php artisan up

Video: X6t7xw1HU-s