# 🚀 cPanel Deployment Guide for Velki 365 Website

Follow these step-by-step instructions to host and deploy your Velki 365 website live on any cPanel web hosting server.

---

## 📋 Prerequisites
- A cPanel Web Hosting account with **Node.js App Setup** support (CloudLinux / Phusion Passenger).
- A domain name (e.g. `velke.site` or `yourdomain.com`).

---

## STEP 1: Upload Project Files to cPanel

1. Zip your project folder `c:\Users\naaz parvin\Desktop\velki` into `velki.zip` (exclude `node_modules`).
2. Log into your **cPanel**.
3. Open **File Manager** -> Navigate to `/home/yourusername/` or `public_html/`.
4. Upload `velki.zip` and **Extract** it into a folder named `velki`.

---

## STEP 2: Import SQL Database in cPanel phpMyAdmin

1. In cPanel, go to **MySQL® Databases**:
   - Create a new Database (e.g. `cpaneluser_velkidb`).
   - Create a new Database User (e.g. `cpaneluser_velkiuser`) with a strong password.
   - Add User to Database with **ALL PRIVILEGES**.
2. Go back to cPanel Home -> Click **phpMyAdmin**:
   - Select your database `cpaneluser_velkidb`.
   - Click the **Import** tab.
   - Choose file `database.sql` from your uploaded project folder.
   - Click **Go** to import all tables and seed data.

---

## STEP 3: Setup Node.js App in cPanel

1. In cPanel, open **Setup Node.js App** (under Software section).
2. Click **Create Application**:
   - **Node.js Version**: Select `20.x` or `18.x`
   - **Application Mode**: `Production`
   - **Application Root**: `velki` (or folder path where files were extracted)
   - **Application URL**: Select your domain (`yourdomain.com` or `velke.site`)
   - **Application Startup File**: `server.js`
3. Click **Create**.
4. After creation, click **Run NPM Install** button to automatically install Express, EJS, and bcryptjs.
5. Click **Restart Application**.

---

## 🔧 How to Fix 403 Forbidden Error on cPanel (`baji.princedev.shop`)

If visiting your domain displays **403 Forbidden**, follow these steps:

1. **Step A: Replace `.htaccess` file**:
   - Upload the updated [`.htaccess`](file:///c:/Users/naaz%20parvin/Desktop/velki/.htaccess) file into `baji.princedev.shop` in cPanel File Manager.
   - It sets `DirectoryIndex server.js` to stop Apache from blocking Node.js requests.

2. **Step B: Check File & Folder Permissions in cPanel**:
   - Folders (like `routes`, `views`, `public`) must have permission **`755`**.
   - Files (like `server.js`, `database.js`, `.htaccess`) must have permission **`644`**.

3. **Step C: Create & Restart Node.js App in cPanel**:
   - Open cPanel -> **Setup Node.js App** -> Click **Create Application**.
   - Application Root: `baji.princedev.shop`
   - Application Startup File: `server.js`
   - Click **Create** -> Click **Run NPM Install** -> Click **Restart Application**.

If visiting your live link shows **Index of /** with folder listings (`middleware`, `node_modules`), perform these 2 steps in cPanel:

1. **Step A: Register Node.js App in cPanel**:
   - Open cPanel -> Search for **Setup Node.js App** (under SOFTWARE section).
   - Click **Create Application**:
     - **Node.js Version**: `20.x` or `18.x`
     - **Application Root**: folder path of `baji.princedev.shop`
     - **Application URL**: `baji.princedev.shop`
     - **Application Startup File**: `server.js`
   - Click **Create** -> Click **Run NPM Install** -> Click **Restart Application**.

2. **Step B: Upload `.htaccess` file**:
   - Upload the `.htaccess` file (included in your project folder) into the root directory of `baji.princedev.shop` in cPanel File Manager.
   - This disables directory listing and routes traffic directly into `server.js`.

1. In cPanel, open **SSL/TLS Status** or **AutoSSL**.
2. Select your domain and click **Run AutoSSL** (or Install Let's Encrypt SSL).
3. Your site is now 100% Live at `https://yourdomain.com`!

---

## 🔑 Default Admin Access on Live Site

- **Website Live URL**: `https://yourdomain.com/`
- **Mobile View**: `https://yourdomain.com/m/`
- **Admin Control Panel**: `https://yourdomain.com/admin`
- **Default Username**: `admin`
- **Default Password**: `admin123`
