Developers and agencies — grow with our partner program
Get started

Blog VPS & Developers

How to Host a Laravel App in Nigeria

By HostPawa Team
Share

Laravel powers a huge share of custom Nigerian web apps: school portals, fintech dashboards, logistics backends, and agency client projects. Hosting it well is less about “which fancy brand” and more about matching PHP, extensions, permissions, queues, and DNS to how Laravel actually runs. This guide walks through a practical path using HostPawa’s Laravel hosting options, PHP hosting, and VPS when you outgrow simpler plans.

Choose the right hosting tier

Shared or PHP-focused hosting can work for smaller Laravel apps that:

  • Do not need long-running queue workers
  • Can run schedule:run via a simple cron entry
  • Stay within memory and process limits
  • Use Redis/Memcached only if the plan supports it—or fall back to database/file drivers carefully

VPS is the better home when you need Supervisor for queues, Redis, multiple Node/PHP services, custom Nginx rules, or predictable CPU/RAM for API traffic. See Laravel hosting for HostPawa’s positioning, and size a VPS if your architecture assumes root-level control.

Environment and PHP requirements

Before you upload anything, confirm:

  • PHP version matches your Laravel version (check the framework docs for the supported range)
  • Extensions: OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype, JSON, BCMath, Fileinfo, and commonly Curl and Redis
  • composer available locally or in CI; deploy vendor/ from a clean composer install --no-dev
  • Writable directories: storage/ and bootstrap/cache/

On HostPawa PHP hosting, pick the PHP version in the panel to match your app. Do not run an old Laravel on an end-of-life PHP simply because “it still works.”

  1. Build artefacts in CI or locally: install Composer dependencies, compile front-end assets (npm ci && npm run build) if you use Vite.
  2. Upload release files: rsync/SFTP/Git deploy into a release directory. Keep .env off Git.
  3. Point the web root at public/—never expose the project root.
  4. Run php artisan migrate --force during a maintenance window when schema changes.
  5. Cache config/routes/views in production: config:cache, route:cache, view:cache as appropriate.
  6. Reload PHP-FPM (on VPS) after env or opcache-sensitive changes.

Configuring .env for production

Set at least:

  • APP_ENV=production and APP_DEBUG=false
  • A long random APP_KEY (generate once; do not rotate casually without a plan)
  • Database credentials for the MySQL/MariaDB user limited to that schema
  • APP_URL with https:// matching your real domain
  • Mailer settings pointing at a transactional provider with good deliverability
  • Queue and cache drivers that match what the server actually provides

Nigeria-specific tip: set the app timezone to Africa/Lagos unless you have a strong reason not to. Inconsistent timestamps confuse ops and support teams.

Queues, schedule, and Supervisor

If the app uses jobs (SMS, invoice PDFs, webhooks), you need a real queue worker—not only HTTP requests. On a VPS, run workers under Supervisor or systemd and monitor failed jobs. On shared hosting, confirm whether long-lived workers are allowed; if not, redesign to synchronous processing for light workloads or move to VPS.

Laravel’s scheduler needs one cron entry:

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

Without it, password resets reminders, subscription checks, and prune commands simply never run.

SSL, DNS, and cutover

  1. Deploy on a staging subdomain first.
  2. Issue HTTPS (Let’s Encrypt or panel SSL).
  3. Test login, file uploads, webhooks, and payment callbacks on HTTPS.
  4. Lower DNS TTL a day before go-live if your DNS host allows it.
  5. Switch the apex/www records to HostPawa and watch logs for 30–60 minutes.

Performance basics that matter locally

  • Enable OPcache on PHP
  • Use a CDN for static assets when audiences are nationwide
  • Avoid storing sessions on an overworked database if Redis is available
  • Paginate heavy Eloquent queries; do not dump entire tables to the browser
  • Log to daily files or an external log drain; rotate so disks do not fill

Security checklist

  • Force HTTPS and secure cookies
  • Keep Laravel and packages updated
  • Restrict .env and storage paths from public access
  • Use strong DB passwords; never reuse panel passwords
  • Rate-limit login and API routes

When to move from PHP hosting to VPS

Move when you see queue backlogs, cron limitations, memory exhaustion during peak fee-payment windows, or a need for Redis/Node sidecars. HostPawa’s Laravel hosting page outlines the intended path; for full control, provision a VPS and deploy with the same Git/CI discipline you use locally.

Bottom line

Hosting Laravel in Nigeria is straightforward when the web root, PHP version, permissions, cron, and queue story are correct. Start on solid PHP hosting for simpler apps; graduate to VPS when workers and custom services appear. Keep APP_DEBUG off, HTTPS on, and Africa/Lagos consistent—and your production evenings get much quieter.

Recent posts

All posts

Launch your website in minutes

Fast hosting, free SSL, and local payments — built for Nigerian businesses.