FrankDevs
website design

How to Deploy a Laravel Project on SiteGround WordPress Hosting GrowBig Plan

cnfrank27 Jan 20266 min read
How to Deploy a Laravel Project on SiteGround WordPress Hosting GrowBig Plan

How to Deploy a Laravel Project on SiteGround WordPress Hosting GrowBig Plan

Introduction

While SiteGround’s WordPress Hosting GrowBig plan is specifically optimized for WordPress sites, many developers wonder if they can use it to host Laravel applications instead. The good news is that it’s entirely possible! In this guide, we’ll walk you through the process of deploying a Laravel project on SiteGround’s WordPress Hosting GrowBig plan.

Understanding SiteGround’s WordPress Hosting GrowBig

Before diving into the deployment process, let’s understand what the GrowBig plan offers. The WordPress Hosting GrowBig plan includes:

  • 20GB storage space
  • Unlimited bandwidth
  • Support for multiple websites
  • Enhanced security and backup features
  • SuperCacher technology for improved performance
  • WordPress staging environment
  • 24/7 customer support

While these features are tailored for WordPress, the underlying infrastructure is fully capable of supporting Laravel applications.

Prerequisites

Before you begin deploying Laravel on SiteGround’s WordPress Hosting GrowBig, ensure you have:

  • An active SiteGround WordPress Hosting GrowBig account
  • SSH access enabled on your account
  • Basic knowledge of command-line operations
  • Composer installed on the server (it comes pre-installed on SiteGround servers)
  • PHP 7.3 or higher (SiteGround supports multiple PHP versions up to 8.3)

Step-by-Step Deployment Guide

Step 1: Enable SSH Access

The first step is to enable SSH access to your account:

  1. Log in to your SiteGround Site Tools
  2. Navigate to Devs section and select SSH Keys Manager
  3. Import your public SSH key for secure authentication
  4. Optionally, restrict SSH access to specific IP addresses for enhanced security

Step 2: Connect via SSH

Once SSH is enabled, connect to your server:

ssh username@your-domain.com

Replace username with your SiteGround username and your-domain.com with your actual domain.

Step 3: Create Your Laravel Project

Navigate to your project directory and create a new Laravel project using Composer:

cd ~/www/your-domain.com
composer create-project --prefer-dist laravel/laravel blog

This command will create a new Laravel project in a folder named blog. If you prefer to install Laravel directly in the root directory (without a subfolder), you can use:

composer create-project --prefer-dist laravel/laravel .

The dot (.) indicates the current directory.

Step 4: Configure Your Web Root

Laravel’s main entry point is the index.php file located in the public/ folder. You need to configure your domain or subdomain to point to this directory.

Option A: Using a Subdirectory

If you want to access your Laravel app at your-domain.com/blog, no additional configuration is needed. The Laravel application will be accessible at that URL.

Option B: Using the Main Domain

If you want your Laravel app to be the primary site (accessed directly from your domain), create a symbolic link:

cd ~/www/your-domain.com
rm -rf public_html  # Remove the default public_html if it exists
ln -s blog/public public_html

Alternatively, you can rename directories or adjust your domain settings in the SiteGround control panel to point to the Laravel public folder.

Step 5: Configure Your Environment File

Navigate to your Laravel project directory and set up the .env file:

cd ~/www/your-domain.com/blog
cp .env.example .env
php artisan key:generate

Edit the .env file with your database credentials:

APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:xxxxxxxxxxxxx  # This was generated by the key:generate command
APP_DEBUG=false
APP_URL=https://your-domain.com

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_db_username
DB_PASSWORD=your_db_password

Step 6: Create and Configure Your Database

In the SiteGround control panel:

  1. Go to Databases section
  2. Click MySQL Databases or MariaDB Databases
  3. Create a new database with your desired name
  4. Create a new database user with a strong password
  5. Assign the user to the database with all privileges

Update your .env file with these credentials.

Step 7: Run Database Migrations

Before your application can run properly, you need to create the necessary database tables:

php artisan migrate

If you have seeders to populate initial data:

php artisan db:seed

Step 8: Set File Permissions

Ensure proper permissions for Laravel’s storage and bootstrap directories:

chmod -R 775 storage
chmod -R 775 bootstrap/cache

Step 9: Optimize Your Application (Optional but Recommended)

For improved performance in production, run these optimization commands:

php artisan config:cache
php artisan route:cache
php artisan view:cache

Important Considerations

Is WordPress Hosting GrowBig the Best Choice for Laravel?

While technically possible, there are some points to consider:

  1. Plan Design: The WordPress Hosting plan is specifically optimized for WordPress. If Laravel is your primary use case, SiteGround’s general Hosting plans might offer better-suited features and support.
  2. Support and Tools: SiteGround’s support team is highly trained in WordPress support. While they can assist with general hosting issues, they may have limited expertise with Laravel-specific problems.
  3. One-Click Installation: The WordPress Hosting plan includes WordPress one-click installation, which won’t be useful for a Laravel project.
  4. Performance Optimization: Features like WordPress staging and WordPress-specific caching may not benefit your Laravel application.

When Should You Consider the Regular Hosting Plan Instead?

If any of the following apply, consider SiteGround’s regular Hosting plans instead:

  • Laravel is your primary or only application
  • You need Laravel-specific support and guidance
  • You plan to deploy multiple Laravel applications
  • You want to maximize performance for non-WordPress applications

Troubleshooting Common Issues

Composer Installation Fails

If Composer runs out of memory:

php -d memory_limit=-1 /usr/local/bin/composer install

Permission Denied Errors

Ensure proper permissions for Laravel directories:

chown -R yourusername:yourusername ~/www/your-domain.com/blog
chmod -R 755 ~/www/your-domain.com/blog
chmod -R 775 ~/www/your-domain.com/blog/storage
chmod -R 775 ~/www/your-domain.com/blog/bootstrap/cache

404 Errors After Deployment

Make sure your .htaccess file exists in the Laravel public directory. If not, create one with:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]

    RewriteRule ^ index.php [L]
</IfModule>

Database Connection Issues

Verify your database credentials in the .env file. Test the connection by running:

php artisan tinker

Then in the Tinker shell:

DB::connection()->getPdo();

If successful, it will return a PDO object without errors.

Conclusion

Deploying Laravel on SiteGround’s WordPress Hosting GrowBig plan is feasible and can work well for small to medium-sized applications. However, it’s important to evaluate whether this plan aligns with your specific needs. If Laravel is your primary project, you might benefit more from SiteGround’s general Hosting plans that are designed to support various PHP-based applications without WordPress-specific limitations.

For the best experience, don’t hesitate to contact SiteGround’s 24/7 support team to discuss your specific Laravel deployment requirements and get their recommendations.

Additional Resources


Ready to grow your business?

Get a free consultation with our team.

Get Started Now
How to Deploy a Laravel Project on SiteGround WordPress Hosting GrowBig Plan | FrankDevs