laravelcPanel Server Laravel (CLI)

Deploy on cPanel

Getting Started Gocab API Deployment

1. Open Gocab-laravel directory that you downloaded from CodeCanyon.

2. Building Assets and SCSS:

circle-exclamation

To set up and compile your assets and SCSS files, follow these steps:

First, you need to install the necessary Node modules.

Compile assets and scss by running below command.

2. Create a .zip file

Zip all files and folders in the Gocab_laravel folder and upload it to your cPanel server.

Delete the node_modules folder from the project or exclude it when creating the zip file.

3. Create Subdomain

Login to your cPanel server and click on domains in the domains section.

Create separate subdomains for Gocab Laravel.

4. Upload Zip file on cPanel:

Upload the Gocab_laravel zip file in the laravel's subdomain (api.your-domain.com).

Click on the Go Back link after the file is 100% uploaded.

5. Extract Laravel Zip File

6. Create MySQL Database:

Now move to cpanel manager and go to > MySQL Database Wizard

Create database in MySQL Database Wizard

Create database users and remember their passwords for the installation process.

Add a user to the database, give them all the necessary permissions, and then click 'Make Changes.' After that, click 'Next Step.

Make a note of the database user, database name, and database password after creating the database.

7. Update Environment File

After creating the MySQL database, go to Gocab_laravel folder from your cPanel file manager and edit .env file.

Add Laravel base url in APP_URL key.

Also, change local to production in APP_ENV.

Add MySQL database credentials.

Add you Gocab-laravel primary domain url like a APP_URL=http://your-domain.com.

circle-exclamation

8. Open cPanel Terminal

Enter terminal in cPanel search bar and select terminal.

If you can't find the terminal, please log in to your local computer terminal or use Putty for Windows via SSH.

circle-exclamation

Once you've opened the terminal, navigate to the root folder of laravel project.

9. Install Required Dependencies:

In the laravel subdomain folder (api.your-domain.com), run this command to install the required dependencies.

10. Generate Laravel APP KEY:

After installing required dependencies, run this command to generate laravel app key.

11. Installation of :

circle-exclamation

Then, run the command to install Gocab database table.

During the installation, you'll be asked two questions:

1. Do you want to continue with the installation? If you say yes, Gocab will continue to install.

2. Do you want to import in sample data? If you say yes, the sample data will be imported. If you say no, the installation will go ahead without adding any sample data.

12. Link Storage folder to Public folder:

To store and display images correctly, then run this command.

13. Verify Gocab Purchase License Code:

Before using the Gocab API, it's important to verify your Envato purchase code.

Enter in your Envato username and the Gocab purchase code and click next button.

If you don't know where to find your purchase code, click here: Where Is My Purchase Code?arrow-up-right

circle-exclamation

Congratulations, Gocab has been successfully installed and configured in your system!🎉

14. Test Your Live Application:

Visit your website in a web browser to ensure everything is working correctly.

References for deploying a Laravel project in cPanel

Here are some references that can guide you through deploying a Laravel project on a cPanel server:

  1. Laravel Official Documentation: It includes sections on deploying Laravel applications and provides insights into best practices.

    Laravel Official Documentation - Deploymentarrow-up-right

  2. cPanel's Documentation: Check for information related to hosting, databases, and other cPanel features.

    cPanel Documentationarrow-up-right

  3. Host-Specific Guides: Your hosting driver might have specific guides or documentation related to Laravel deployment.

Setup Cron Job

Below is a step-by-step guide on how to set up a cron job in cPanel for running a Laravel command.

1. Access cPanel

Log in to your cPanel account using your credentials provided by your hosting driver.

2. Navigate to the Cron Jobs Section

  1. In the cPanel dashboard, scroll down to the "Advanced" section.

  2. Click on "Cron Jobs."

3. Configure the Cron Job

To configure the cron job to run your Laravel command, follow these steps:

  1. Select common settings which you want to run Laravel schedule command (e.g., every 5 minutes).

  2. In the Command field, enter the path to Laravel's artisan file from the API subdomain's root directory (e.g., api.your-domain.com/artisan) and include the following command: schedule:run

  3. To enable notifications, you also need to set up the queue worker. Use the following command: queue:work --once This should be run from the same API subdomain root folder (api.your-domain.com).

  4. Click to Add New Cron Job Button, then add new cron job in cPanel.

Default Credentials

Admin Credential:

Url: https://your-domain.com/admin/loginarrow-up-right

Email: admin@example.com

Password: 123456789

Driver Credential:

Url: https://your-domain.com/admin/loginarrow-up-right

Email: driver@example.com

Password: driver@123

User Landing Page: https://your-domain.comarrow-up-right

Last updated