Files
2026-05-06 04:10:43 +00:00

7.1 KiB

Epic Travel & Expeditions - cPanel Deployment Guide

Overview

This package contains the Epic Travel & Expeditions website configured for cPanel hosting with MySQL database.

Requirements

  • cPanel hosting with:
    • Python 3.8+ support
    • MySQL 5.7+ or MariaDB 10.3+
    • Apache with mod_rewrite enabled
    • SSL certificate (recommended)
  • At least 500MB disk space
  • PHP 7.4+ (optional, for phpMyAdmin)

Package Contents

epic-travel-cpanel/
├── backend/                  # Python FastAPI backend
│   ├── routes/              # API endpoints
│   ├── models/              # Database models
│   ├── server.py            # Main application
│   ├── requirements.txt     # Python dependencies
│   └── .env.example         # Environment template
├── frontend/                 # React frontend (production build)
│   ├── build/               # Compiled React app
│   └── .htaccess            # Apache configuration
├── database_schema.sql       # MySQL database schema
├── setup_admin.py           # Admin user setup script
└── INSTALLATION.md          # This file

Installation Steps

Step 1: Database Setup

  1. Create MySQL Database

    • Log into cPanel → MySQL Databases
    • Create new database: username_epic_travel
    • Create database user with strong password
    • Grant ALL PRIVILEGES to the user
  2. Import Database Schema

    • Go to phpMyAdmin
    • Select your database
    • Click "Import" tab
    • Upload database_schema.sql
    • Click "Go"
  3. Generate Admin Password Hash

    cd backend
    python3 setup_admin.py
    
    • Copy the generated hash
    • Update the admin_users INSERT statement in the SQL file if needed

Step 2: Backend Setup

  1. Upload Backend Files

    • Upload backend/ folder to your cPanel account
    • Recommended location: ~/epic-travel-api/
  2. Install Python Dependencies

    cd ~/epic-travel-api
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
  3. Configure Environment

    • Copy .env.example to .env
    • Edit .env with your settings:
    MYSQL_HOST=localhost
    MYSQL_PORT=3306
    MYSQL_DATABASE=username_epic_travel
    MYSQL_USER=username_dbuser
    MYSQL_PASSWORD=your_secure_password
    JWT_SECRET_KEY=your_random_256bit_key
    ADMIN_DEFAULT_PASSWORD=Joker1974!!!
    CORS_ORIGINS=https://yourdomain.com
    
  4. Setup Python Application

    • In cPanel → Setup Python App
    • Python version: 3.8+
    • Application root: /home/username/epic-travel-api
    • Application URL: /api
    • Application startup file: server.py
    • Application Entry point: app
    • Click "Create"
  5. Install Dependencies via cPanel

    • In the Python App configuration
    • Click "Run pip install" button
    • Or run: pip install -r requirements.txt

Step 3: Frontend Setup

  1. Upload Frontend Build

    • Upload contents of frontend/build/ to your public_html
    • Or to a subdomain folder
  2. Configure .htaccess

    • Ensure .htaccess is present in the root
    • Modify if your API is on a different path
  3. Update API URL

    • In public_html/static/js/main.*.js
    • Or set via environment variable during build

Step 4: SSL Configuration

  1. Enable SSL

    • In cPanel → SSL/TLS
    • Install Let's Encrypt certificate (free)
    • Enable "Force HTTPS Redirect"
  2. Update CORS

    • Edit backend .env
    • Set: CORS_ORIGINS=https://yourdomain.com
    • Restart Python application

Step 5: Testing

  1. Test Backend API

    curl https://yourdomain.com/api
    

    Should return: {"message": "Epic Travel API is running", "status": "healthy"}

  2. Test Frontend

  3. Test Admin Login

Configuration Files

Backend .env

# Database Configuration
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_DATABASE=username_epic_travel
MYSQL_USER=username_dbuser
MYSQL_PASSWORD=your_password

# Security
JWT_SECRET_KEY=generate_with_openssl_rand_hex_32
ADMIN_DEFAULT_PASSWORD=Joker1974!!!

# CORS
CORS_ORIGINS=https://yourdomain.com

Frontend .htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  
  # API Proxy
  RewriteCond %{REQUEST_URI} ^/api/(.*)$
  RewriteRule ^api/(.*)$ https://yourdomain.com/api/$1 [P,L]
  
  # React Router
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.html [L]
</IfModule>

Troubleshooting

Backend not starting

  • Check Python version: python3 --version
  • Check error logs in cPanel
  • Verify MySQL connection details
  • Ensure all dependencies installed

Frontend shows blank page

  • Check browser console for errors
  • Verify API URL in frontend build
  • Check .htaccess file exists
  • Clear browser cache

Database connection fails

  • Verify MySQL credentials
  • Check if database user has proper privileges
  • Ensure MySQL server is running
  • Check host (use 'localhost' not '127.0.0.1')

CORS errors

  • Update CORS_ORIGINS in backend .env
  • Restart Python application
  • Check SSL configuration
  • Ensure frontend and backend use same protocol (HTTPS)

Performance Optimization

  1. Enable Gzip Compression

    • Add to .htaccess:
    <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/json
    </IfModule>
    
  2. Enable Browser Caching

    • Add to .htaccess:
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType image/jpg "access plus 1 year"
      ExpiresByType image/jpeg "access plus 1 year"
      ExpiresByType image/png "access plus 1 year"
      ExpiresByType text/css "access plus 1 month"
      ExpiresByType application/javascript "access plus 1 month"
    </IfModule>
    
  3. MySQL Optimization

    • Add indexes to frequently queried columns
    • Use connection pooling
    • Enable query caching

Maintenance

Updating the Application

  1. Backup database: Export via phpMyAdmin
  2. Backup files: Download via FTP
  3. Upload new files
  4. Run any database migrations
  5. Restart Python application

Database Backup

mysqldump -u username -p username_epic_travel > backup_$(date +%Y%m%d).sql

Monitoring

  • Check error logs in cPanel
  • Monitor disk space usage
  • Review database size
  • Check Python app status

Support

For issues specific to this application:

  • Check logs in cPanel
  • Verify all configuration settings
  • Ensure MySQL connection is working
  • Test API endpoints individually

Security Checklist

  • Strong MySQL password set
  • JWT secret key generated and set
  • Admin password changed from default
  • SSL certificate installed
  • HTTPS redirect enabled
  • CORS properly configured
  • File permissions set correctly (644 for files, 755 for directories)
  • .env file protected (not web-accessible)

Credits

Epic Travel & Expeditions Contact: advisor@epictravelexpeditions.com Phone: +1 (817) 266-2022