| |

Deploy WordPress, Laravel & Node.js in cPanel: Git Guide

Visual overview of Deploy WordPress, Laravel & Node.js in cPanel in cPanel hosting

Verified Answer

cPanel supports full-stack app deployments natively: use Softaculous or WP Toolkit for 1-click WordPress installs and staging, Git Version Control with .cpanel.yml for automated Laravel and PHP builds, and Setup Node.js App (Phusion Passenger) to host Express, Next.js, or API backends without manual reverse proxies.

Many developers still view cPanel as a legacy FTP panel, yet modern builds include native orchestration for WordPress, Laravel, and Node.js. Using WP Toolkit, Git Version Control with .cpanel.yml, and Phusion Passenger Node.js App Manager streamlines automated production deployments cleanly.

Softaculous & WP Toolkit

Automate WordPress provisioning, database setup, staging clones, and safe core updates cleanly.

Git & .cpanel.yml Builds

Pull private repos over SSH and run Composer or Laravel Artisan tasks automatically.

Node.js Passenger Apps

Run isolated Express or Next.js backends without configuring manual reverse-proxy rules.

Deploying & Hardening WordPress with Softaculous

For content-driven sites and WooCommerce storefronts on high-performance cPanel hosting, Softaculous automates database provisioning, table-prefix randomization, and HTTPS installation in under 30 seconds. To avoid default security pitfalls, follow these configuration choices during setup:

  1. Open cPanel → Software → Softaculous Apps Installer, select WordPress, and click Install Now.
  2. Set Choose Protocol to https:// and leave the In Directory field empty so WordPress installs at the root of your domain rather than /wp.
  3. Change the default Admin Username away from admin, generate a 20+ character password, and customize the Table Prefix (e.g., ols9x_ instead of wp_).
  4. Under Advanced Options, enable Auto Upgrade WordPress Plugins only if you maintain a staging clone, or keep minor core security updates enabled while testing major updates in Softaculous’s built-in Create Staging tool.

Softaculous also tracks your installation in its All Installations dashboard, letting you push a staging site live, clone a production site for client previews, or roll back a broken update without touching phpMyAdmin.

Configuring Staging Clones and WP-CLI Automation

For active WooCommerce stores, never test major plugin or PHP upgrades directly on production. Inside Softaculous All Installations, click the Create Staging icon next to your site and deploy it to a subdomain such as staging.yourdomain.com. Softaculous automatically clones the database, runs search-and-replace on serialized URLs, and updates wp-config.php. When pushing changes back to live, use the Customize push option so you only overwrite modified theme/plugin files without wiping newly placed customer orders in the live database. Additionally, pair Softaculous WordPress installs with a real cPanel cron job running wp cron event run --due-now every 5 minutes (with DISABLE_WP_CRON set to true in wp-config.php) to prevent visitor page loads from triggering heavy background tasks.

Deploying Laravel & PHP Apps via cPanel Git Version Control

When deploying custom Laravel, Symfony, or modern PHP applications, manual ZIP uploads are error-prone and leave stale vendor files behind. cPanel’s native Git Version Control (found under the Files section) lets you clone a GitHub, GitLab, or Bitbucket repository directly into your account and trigger automated deployment tasks on every pull.

Never clone a Laravel repository directly into public_html—doing so exposes your .env credentials, composer.json, and application source code to the public web. Instead, keep the repository outside the web root:

  • Clone your repository into /home/username/repositories/laravel-app.
  • If deploying to an Addon Domain or Subdomain, set its Document Root inside cPanel → Domains directly to /home/username/repositories/laravel-app/public.
  • If deploying to your primary domain (whose Document Root is fixed at public_html on shared hosting), rename or empty public_html and create a symbolic link from public_html to /home/username/repositories/laravel-app/public via SSH: ln -s /home/username/repositories/laravel-app/public /home/username/public_html.

Writing a Production .cpanel.yml Deployment File

Place a .cpanel.yml file in the root of your Git repository. Whenever you click Update from Remote and Deploy HEAD Commit inside cPanel Git Version Control, cPanel executes the shell commands listed under tasks:

Terminal / CLI
---
deployment:
  tasks:
    - export APP_DIR=/home/username/repositories/laravel-app
    - cd $APP_DIR && /usr/local/bin/ea-php83 /opt/cpanel/composer/bin/composer install --no-dev --optimize-autoloader
    - cd $APP_DIR && /usr/local/bin/ea-php83 artisan migrate --force
    - cd $APP_DIR && /usr/local/bin/ea-php83 artisan config:cache
    - cd $APP_DIR && /usr/local/bin/ea-php83 artisan route:cache
    - cd $APP_DIR && /usr/local/bin/ea-php83 artisan view:cache

For private GitHub or GitLab repositories, generate an SSH key pair inside cPanel → Security → SSH Access (without a passphrase for automated pulls) and add the public key as a read-only Deploy Key in your repository settings. Before running migrations, create your MySQL database and user via our cPanel MySQL Database Wizard guide and store the credentials in your server-side .env file.

Keep .env and user-uploaded media out of Git tracking (via .gitignore) so a git pull never overwrites production database passwords or deletes uploaded avatars. On your initial server setup, create your production .env directly inside /home/username/repositories/laravel-app/.env with chmod 600 permissions, and run /usr/local/bin/ea-php83 artisan storage:link once so /public/storage points cleanly to /storage/app/public. If your .cpanel.yml runs composer install on a live site, consider toggling artisan down --render="errors::503" at the start of the task block and artisan up at the end so visitors never hit a half-updated vendor autoloader.

Deploying Node.js Applications with Setup Node.js App

Traditional Node.js hosting requires binding an Express or Fastify server to a custom port (like 3000) and configuring PM2 plus an Nginx reverse proxy. Inside cPanel (with CloudLinux Node.js Selector or cPanel Application Manager), Setup Node.js App automates this using Phusion Passenger, binding your Node.js process directly to your domain’s standard HTTPS port 443.

  1. Upload or Git-clone your Node.js project into a non-public folder such as /home/username/nodeapps/api-service.
  2. Open cPanel → Software → Setup Node.js App and click Create Application.
  3. Select your required Node.js version (e.g., 18.x, 20.x, or 22.x) and set Application mode to Production.
  4. Enter the Application root (nodeapps/api-service), the Application URL (e.g., api.yourdomain.com), and the Application startup file (e.g., server.js or dist/index.js).
  5. Add your production Environment variables (DATABASE_URL, JWT_SECRET, NODE_ENV=production) directly in the UI, then click Create.
  6. Click Run NPM Install to install packages from package.json inside the isolated virtual environment, then click Restart.

Important Passenger Gotcha: Do not hardcode a static port like app.listen(3000) if your host uses Passenger socket interception—either use process.env.PORT || 3000 or let Passenger bind the HTTP server automatically. Also avoid placing heavy npm run build tasks (such as compiling a large Next.js app) on low-RAM shared accounts; build static bundles in GitHub Actions first and deploy the compiled dist/ or .next/ output.

Debugging Passenger Logs, Restarting Workers & Static Builds

When a Node.js app returns a 503 Service Unavailable or We're sorry, but something went wrong Passenger error page, open your application root directory via File Manager or SSH and inspect stderr.log. Most startup crashes stem from a missing environment variable, an ES Module vs. CommonJS mismatch (require() vs. import), or a database firewall block. To restart your Node.js worker quickly from SSH or a .cpanel.yml script without logging into cPanel, run mkdir -p tmp && touch tmp/restart.txt inside the application root—Phusion Passenger watches that timestamp and gracefully reloads the Node.js process on the next request.

Securing Environment Variables, Cron Schedulers & PHP Versions

After deploying your application, lock down runtime security and background processing:

  • Pin PHP Versions Per Domain: Use cPanel MultiPHP Manager so legacy sites and modern Laravel 11 apps can run different PHP versions side by side on the same account.
  • Configure Laravel Task Scheduling: Add a single every-minute cron job in cPanel → Advanced → Cron Jobs pointing to artisan schedule:run (see our cPanel Cron Jobs setup guide for proper output redirection).
  • Restrict Sensitive Files via .htaccess: Even when using symlinks, add a root .htaccess rule denying public HTTP access to .env, .git, and .yml files just in case a misconfiguration exposes the parent directory.

Troubleshooting Common Softaculous, Git & Node.js Deployment Errors

Even well-structured pipelines hit occasional environment snags. Keep these rapid fixes handy when deploying on cPanel:

  • Git Clone Fails with Permission denied (publickey): Confirm your private key inside ~/.ssh/ has chmod 600 permissions, verify the public key is added to GitHub/GitLab Deploy Keys, and ensure ~/.ssh/config maps the host to the correct key file.
  • Composer Fails with Allowed memory size exhausted: Prefix your Composer command in .cpanel.yml with COMPOSER_MEMORY_LIMIT=-1 or increase PHP’s CLI memory_limit to 1024M so dependency resolution completes cleanly.
  • Laravel 404 on All Routes Except Homepage: Verify that mod_rewrite rules in /public/.htaccess were copied and that no conflicting .htaccess in the parent folder is overriding rewrite behavior.
  • Softaculous File Permissions & Cron Overlap: If WordPress plugin updates fail with a filesystem credentials prompt, confirm files are owned by your cPanel user (644 for files, 755 for folders) rather than nobody. When running Composer or WP-CLI via cron, use flock file locking so overlapping cron runs do not corrupt vendor or cache directories.
  • Node.js EADDRINUSE or Static Asset 404s: Ensure your Express app serves static assets from a relative path.join(__dirname, 'public') and never attempts to bind a second listener port when Phusion Passenger manages the socket.

Choosing the Right cPanel Deployment Method

Application Stack Recommended Tool Target Directory Key Benefit
WordPress / WooCommerce Softaculous / WP Toolkit /home/user/public_html 1-click staging, cloning, and auto-updates
Laravel / Symfony / Custom PHP Git Version Control + .cpanel.yml /home/user/repositories/app (linked to /public) Repeatable Composer & Artisan deployments
Express / Node.js API / SSR Setup Node.js App (Passenger) /home/user/nodeapps/app Isolated Node runtime & automatic HTTPS routing

Frequently Asked Questions

Can cPanel Git Version Control auto-deploy when I push to GitHub?

By default, cPanel Git Version Control uses manual Update from Remote and Deploy HEAD Commit buttons. To automate deployments on git push, either add a lightweight webhook PHP endpoint that triggers uapi VersionControlDeployment create, or use GitHub Actions over SSH to run git pull and Composer/Artisan commands.

Can I deploy Laravel in cPanel without SSH access?

Yes, though SSH makes it much smoother. Without SSH, you can run composer install --no-dev locally, push or upload the repository, point your Addon Domain’s Document Root to the /public folder in cPanel Domains, and use .cpanel.yml to copy files cleanly.

Why does npm install fail with a memory error in cPanel?

Shared cPanel accounts enforce CloudLinux LVE physical memory limits (often 1–2 GB). Heavy frontend build tools like Webpack or Vite can exceed that ceiling during npm install or npm run build. Build your static assets in CI/CD (GitHub Actions) first, or upgrade to a Managed cPanel VPS for dedicated RAM.

Is Softaculous WordPress installation slower than a manual install?

No. Softaculous installs the exact same official WordPress core files and MySQL schema as a manual upload, while adding convenient staging, cloning, and backup hooks without adding runtime bloat. You can also import an existing manual WordPress installation into Softaculous at any time using its Scan/Import feature so you gain staging and backup automation retroactively.

Can I run different Node.js versions for different apps in the same cPanel account?

Yes. CloudLinux’s Setup Node.js App creates an isolated virtual environment per application, allowing an older API to stay on Node.js 18 while a newer service runs on Node.js 20 or 22 simultaneously.

How do I restart a cPanel Node.js app from SSH or a Git deployment script?

Create or update the timestamp on tmp/restart.txt inside your Node.js application root (mkdir -p tmp && touch tmp/restart.txt). Phusion Passenger detects the updated file and restarts your Node.js worker automatically.

Deploying WordPress, Laravel, and Node.js via Git?

WP Toolkit, .cpanel.yml Git deployments, and Phusion Passenger turn cPanel into a full-stack host. Review cPanel hosting plans supporting Git Version Control and Node.js apps.

Review Developer-Ready cPanel Plans

Deploy WordPress, Laravel & Node.js on Developer-Ready cPanel

Get Softaculous 1-click staging, SSH & Git deployment, MultiPHP 8.3, and Node.js Passenger support out of the box on OnliveServer’s high-performance cPanel hosting.

Launch Your App on cPanel →