This guide explains how to deploy Inventoros on shared hosting using cPanel.
Before deploying, ensure your hosting provider supports:
- PHP 8.2 or higher
- MySQL 8.0+ or PostgreSQL 13+
- Composer (or SSH access to run it)
- Node.js 18+ (for building assets, can be done locally)
Before uploading, build the frontend assets locally:
npm install
npm run buildThis creates the production-ready assets in the public/build directory.
You have two options for uploading:
Option A: File Manager
- Log into cPanel
- Open File Manager
- Navigate to your domain's root directory (usually
public_htmlor a subdomain folder) - Upload all files from the Inventoros project
Option B: FTP/SFTP
- Connect using your FTP credentials from cPanel
- Upload all project files to your domain's root directory
Laravel requires the public folder to be the document root. You have two approaches:
Option A: Subdomain/Addon Domain (Recommended)
- In cPanel, go to Domains > Subdomains or Addon Domains
- Set the document root to point to
/public_html/inventoros/public(adjust path as needed)
Option B: Main Domain with .htaccess
If you must use the main public_html folder, add this .htaccess file to your root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>- Rename or copy
.env.exampleto.env - Update the following values:
APP_NAME=Inventoros
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_user
DB_PASSWORD=your_database_password- In cPanel, go to MySQL Databases
- Create a new database
- Create a new database user with a strong password
- Add the user to the database with All Privileges
- Update your
.envfile with these credentials
If you have SSH access:
php artisan key:generateIf you don't have SSH access, generate a key locally and copy the APP_KEY value to your .env file on the server.
With SSH access:
php artisan migrate --forceWithout SSH access:
You can use the web-based installer at /install if the application hasn't been set up yet, or import the database schema manually through phpMyAdmin.
Ensure these directories are writable (755 or 775):
storage/
bootstrap/cache/
In cPanel File Manager:
- Right-click on
storagefolder - Select Change Permissions
- Set to
755or775 - Check "Recurse into subdirectories"
- Repeat for
bootstrap/cache
If you need Laravel's task scheduler:
- In cPanel, go to Cron Jobs
- Add a new cron job with the following command:
* * * * * cd /home/username/public_html/inventoros && php artisan schedule:run >> /dev/null 2>&1
Replace /home/username/public_html/inventoros with your actual path.
- In cPanel, go to SSL/TLS or Let's Encrypt SSL
- Generate and install an SSL certificate for your domain
- Update
APP_URLin.envto usehttps://
- Check file permissions on
storage/andbootstrap/cache/ - Verify
.envfile exists and has correct database credentials - Check
storage/logs/laravel.logfor detailed error messages
- Ensure
APP_DEBUG=truetemporarily to see errors - Verify PHP version is 8.2 or higher (check in cPanel > Select PHP Version)
- Verify you ran
npm run buildbefore uploading - Check that
public/builddirectory was uploaded - Ensure your document root points to the
publicfolder
- Verify database credentials in
.env - Ensure the database user has proper privileges
- Check if
localhostshould be127.0.0.1(varies by host)
Most cPanel hosts allow you to select the PHP version:
- Go to Select PHP Version or MultiPHP Manager
- Select your domain
- Choose PHP 8.2 or higher
- Enable required extensions:
pdo_mysql,mbstring,openssl,tokenizer,xml,ctype,json,bcmath
- Enable OPcache in PHP settings
- Use Redis for session/cache if available (update
.envaccordingly) - Enable gzip compression via
.htaccess - Consider using Cloudflare for CDN and additional caching