Technical Documents /

Laravel Application Deployment Guide to Cyberpanel

Visit the Cyberpanel application using the following url format: https://ipaddress:8090 here cyberpanel login screen shows up, Here enter the username and password into the panel.

 



 

After successfully logged in click on the websites button.

 







Here on the Website Functions panel, click on the List Website

 

 

In List Websites panel, click on the Manage option on the website you wish to manage.

 



Here you see the management panel for the particular website.

 



Scroll down little bit, click on the File Manager button on the panel.

 



In the filemanager, double click on the public_html folder.

 



Click on the Upload button on the top of the panel.

 

 

Here Upload File modal pops up, zip your code and drag and drop here.

 




Click on the Upload button here.

 

 

The right mark shows file uploaded successfully, click on the close button.

 



Right click on the zip file, on the drop down menu click on the Extract menu.

 



On the pop up modal window, click on the Extract button.

 



Navigate to the extracted folder,

 





Move the all files and folder to the outside of the folder

 

 

After all files and folders are moved, delete the empty folder.

 










Database Creation

On the website management panel, Go to the Databases -> Create Database

 



Select the website / application you wish to create the database for.

 










Enter the database credentials here:

 



Click on the Create Database button.











Navigate to the folder where application code is located, here edit the .env file.

 



On the .env file change the database credentials.

 

 

Change the APP_URL

 








Change the APP_NAME



Change the APP_ENV to production

 

 

Click on the Save Changes button to save the changes.

 
















Navigate to the root of the application in file manager, Here click on the New File button.





Enter the file name as .htaccess and click on the Create File button

 















Right click on the .htaccess file, and click on the Edit with CodeMirror menu

 

 

Paste the following code inside the .htaccess file



### Rewrite Rules Added by CyberPanel Rewrite Rule Generator


RewriteEngine On

RewriteCond %{HTTPS}  !=on

RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]


### End CyberPanel Generated Rules.


<IfModule mod_rewrite.c>

RewriteEngine On

RewriteRule ^(.*)$ public/$1 [L]

</IfModule>

 




Click on the Save Changes button to save the changes.



SSH into the Server



Go to the main page of the site, here click on the Setup SSH Access button.

 



On the SSH ACCESS panel, enter the password for the specified user.

 




Click on the Save Changes button.

 



Download and Install the Putty software from this url:

 

https://www.putty.org



After the installation open putty and enter the the IP Address in Host Name or IP Address) and click on the Open button.

 

Accept the fingerprint warning.

 

 

Enter the username and password in login prompt.

 






Navigate to the public_html folder by typing the following:

 

cd public_html

 

List the files and folder in the current directory using the following command:

 

ls

 

Install the Composer packages:

 

For php 8.0 do the following:

/usr/local/lsws/lsphp80/bin/php /usr/bin/composer install

 

For php 8.1 do the following:

 

/usr/local/lsws/lsphp81/bin/php /usr/bin/composer install

 

Check if the node is installed, if node is not installed do the following to install nvm:

 

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

 

Use this command to load nvm

 

export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

 

Use the nvm to install particular nodejs version

 

nvm install 16.15.1

 





Use the following command to install the nodejs packages.

 

npm install



Compile the frontend assets using this command

 

npm run build



Generate Application Key: Generate a new application key on the destination server by running the following command:

/usr/local/lsws/lsphp81/bin/php artisan key:generate

 

Run Migrations: Migrate the database schema on the destination server using the following command:

 

/usr/local/lsws/lsphp81/bin/php artisan migrate



Seed the Database: If your application uses database seeders, run them on the destination server to populate the necessary data:

 

/usr/local/lsws/lsphp81/bin/php artisan db:seed

 

Clear Application Cache: This command clears the application cache, including routes, configurations, and other cached data.

 

/usr/local/lsws/lsphp81/bin/php artisan cache:clear

 

Clear Configuration Cache: This command clears the configuration cache, which refreshes the cached configuration files.

 

/usr/local/lsws/lsphp81/bin/php artisan config:clear



Clear Compiled Views: If you are using the Laravel Blade template engine and have compiled views, you can clear the compiled views cache using this command.




Clear Route Cache: This command clears the route cache, which refreshes the cached route files.

 

/usr/local/lsws/lsphp81/bin/php artisan route:clear



Clear Compiled Views: If you are using the Laravel Blade template engine and have compiled views, you can clear the compiled views cache using this command



/usr/local/lsws/lsphp81/bin/php artisan view:clear



Clear Application Cache and Optimized Files: This command clears the application cache and removes all optimized files, including cached classes and services.

 

/usr/local/lsws/lsphp81/bin/php artisan optimize:clear



Clear Event Cache: If you are using Laravel's event system, you can clear the cached events and listeners with this command.

 

/usr/local/lsws/lsphp81/bin/php artisan event:clear



Need more help?

Call our team  01482 795288