# cPanel Server Laravel (CLI)

**Deploy on cPanel**

### **Getting Started Taxido API Deployment**

**1. Open Taxido-laravel directory that you downloaded from CodeCanyon.**

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/Taxido-laravel-folder.png" alt=""><figcaption></figcaption></figure>

**2. Building Assets and SCSS:**

{% hint style="warning" %}
**Note:** Please make sure you've installed NodeJs. If you haven't installed, you can easily do by following this link: [Link to Laravel Prerequisites.](https://docs.pixelstrap.net/laravel/taxido/laravel-requirment.html#nodejs)
{% endhint %}

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

&#x20;First, you need to install the necessary Node modules.

```html
npm i
```

Compile assets and scss by running below command.

```html
npm run build
```

**2. Create a .zip file**

Zip all files and folders in the Taxido\_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.

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/vps/env.png" alt=""><figcaption></figcaption></figure>

**3. Create Subdomain**

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

Create separate subdomains for Taxido Laravel.

```html
your-domain.com -> Taxido_laravel.
```

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2FkqTG5y6e9nqazFsUSBhp%2Fimage.png?alt=media&#x26;token=937719b1-640f-4e85-9b32-6f86becba91f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-domain-2.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2FUew2X7C8RXl9nQaaxRRo%2Fimage.png?alt=media&#x26;token=b9d5aaf4-cbdf-44d6-b226-2e8d01fef738" alt=""><figcaption></figcaption></figure>

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2Ft0oxgYP28Hw9Hbuw26kV%2Fimage.png?alt=media&#x26;token=adc8bef9-69e0-477e-ad1e-982de2fac27e" alt=""><figcaption></figcaption></figure>

**4. Upload Zip file on cPanel:**

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-upload.png" alt=""><figcaption></figcaption></figure>

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

**5. Extract Laravel Zip File**

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-extract.png" alt=""><figcaption></figcaption></figure>

**6. Create MySQL Database:**

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-database-1.png" alt=""><figcaption></figcaption></figure>

Create database in MySQL Database Wizard

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-database-2.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2FFN9IkB9lQD9R3Zwdn2bD%2Fimage.png?alt=media&#x26;token=3ebdcb77-7185-4cfd-abc4-dbf55a9d9dea" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-database-4.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-databse-5.png" alt=""><figcaption></figcaption></figure>

**7. Update Environment File**

&#x20;After creating the MySQL database, go to Taxido\_laravel folder from your cPanel file manager and edit **.env** file.

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-4.png" alt=""><figcaption></figcaption></figure>

Add Laravel base url in APP\_URL key.

Also, change local to production in APP\_ENV.

Add MySQL database credentials.

Add you Taxido-laravel primary domain url like a APP\_URL=<http://your-domain.com>.

```html
APP_URL=https://your-domain.com
APP_ENV=production
DB_DATABASE=your_db_name
DB_USERNAME=your_db_username
DB_PASSWORD=your_db_password
```

{% hint style="warning" %}
Note: Make sure to set the APP\_URL correctly. If you don't, features like uploading, downloading, and showing images won't work properly. Be sure to double-check and make sure everything is set up correctly.
{% endhint %}

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2FcyIOXZuDwQcrGDZ37Wg1%2Fimage.png?alt=media&#x26;token=9a385f48-5056-4d3c-8b4f-bdebebc70e3c" alt=""><figcaption></figcaption></figure>

**8. Open cPanel Terminal**

Enter terminal in cPanel search bar and select terminal.

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-terminal.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-ssh.png" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If you can't find the terminal, please contact your hosting driver, as they manage the cPanel control.
{% endhint %}

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

<div align="left"><figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-terminal-cmd.png" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2F93BYjzj00TaVjlh8oDuZ%2Fimage.png?alt=media&#x26;token=c8b86f4a-abda-47ef-9611-7ca3bfeb721d" alt=""><figcaption></figcaption></figure>

**9. Install Required Dependencies:**

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

```html
 composer install 
```

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-terminal-composer.png" alt=""><figcaption></figcaption></figure>

**10. Generate Laravel APP KEY:**

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

```html
 php artisan key:generate
```

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-terminal-key.png" alt=""><figcaption></figcaption></figure>

**11. Installation of Taxido:**

{% hint style="warning" %}
**Warning:** If you've previously run this command or migrated tables, be aware of the fact that it will erase all of your data.
{% endhint %}

Then, run the command to install Taxido database table.

```html
 php artisan web:install
```

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

1\. Do you want to continue with the installation? If you say yes, Taxido 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.

```html
php artisan storage:link
```

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cPanel/cpanel-terminal-storage.png" alt=""><figcaption></figcaption></figure>

**13. Verify Taxido Purchase License Code:**

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

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

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/installer-3-1.png" alt=""><figcaption></figcaption></figure>

If you don't know where to find your purchase code, click here: [Where Is My Purchase Code?](https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code)

{% hint style="warning" %}
**Note:** Once a license is verified, it can't be used for another project. An envato purchase code can only be verified on one domain at a time.
{% endhint %}

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/vps/clipboard-image%20(1).png" alt=""><figcaption></figcaption></figure>

Congratulations, Taxido 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 - Deployment](https://laravel.com/docs/10.x/deployment)
2. **cPanel's Documentation:** Check for information related to hosting, databases, and other cPanel features.

   [cPanel Documentation](https://docs.cpanel.net/cpanel/)
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.

&#x20;**1. Access cPanel**

&#x20;  Log in to your cPanel account using your credentials provided by your hosting driver.

**2. Navigate to the Cron Jobs Section**

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2Fq1vwXtvuPIWFQ38C4Wl2%2Fimage.png?alt=media&#x26;token=5b5fd965-a04e-486d-84d2-270a0378973f" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="https://docs.pixelstrap.net/laravel/taxido/assets/images/laravelApi/cron-job-2.png" alt=""><figcaption></figcaption></figure>

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:**

&#x20;  Url: <https://your-domain.com/admin/login>&#x20;

&#x20;  Email: <admin@example.com>

&#x20;  Password: 123456789

&#x20;**Driver Credential:**

&#x20; Url: <https://your-domain.com/admin/login>

&#x20; Email: <driver@example.com>

&#x20; Password: driver\@123

&#x20; **User Landing Page:** [**https://your-domain.com**](https://your-domain.com/)
