How to Deploy Laravel on SiteGround?

10 minutes read

To deploy Laravel on SiteGround hosting, follow these steps:

  1. First, make sure your Laravel project is ready for deployment. Ensure that you have installed all the necessary dependencies and configured the project settings, including database connections.
  2. Log in to your SiteGround hosting account and navigate to the cPanel dashboard. Look for the "File Manager" or "FTP Accounts" section.
  3. In the File Manager or FTP Accounts section, create a new FTP account with the necessary permissions to access and modify your website files.
  4. Once the FTP account is created, open a File Manager or use an FTP client (such as FileZilla) to connect to your SiteGround hosting account using the FTP account credentials.
  5. Locate the public_html directory or the root directory of your website in the File Manager. This is typically where you want to deploy your Laravel project.
  6. If you are deploying Laravel in the root directory, delete any existing files or move them to a backup folder. Otherwise, create a new directory (e.g., "laravel") in the root directory to hold your Laravel project.
  7. Next, upload all the files and directories from your local Laravel project to the desired deployment location on SiteGround using the File Manager or FTP client. Make sure to preserve the folder structure.
  8. Once the files are uploaded, navigate to the root directory or the Laravel directory, depending on your setup.
  9. In that directory, locate the public folder. Select all the files and directories inside the public folder and move them one level up to the root directory (or public_html directory).
  10. Go back to the root directory and locate the index.php file. Right-click on it and choose the "Code Editor" option (or any text editor available). Edit the file, changing the following two lines:
  • Update the $app variable to point to the correct autoload.php file: $app = require_once __DIR__.'/../bootstrap/app.php';
  • Update the $app variable to run the application: $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
  1. Save the index.php file after making the necessary changes.
  2. Once all the files are in place and the necessary modifications are made, your Laravel application should now be deployed on SiteGround hosting. You can visit your website's domain name to see if the deployment was successful.

Remember to configure any environment-specific variables, such as database credentials, to ensure your Laravel application runs correctly in the new environment.

Best Cloud Hosting Providers of 2024


Rating is 5 out of 5


  • Ultra-fast Intel Core
  • Low Price and High Quality
  • High Performance and Cheap Cloud Dedicated Servers
Digital Ocean

Rating is 4.9 out of 5

Digital Ocean

  • Active Digital Community
  • Simple To Use
  • Starting as low as 5$ per month

Rating is 4.8 out of 5



Rating is 4.7 out of 5


How to deploy Laravel on SiteGround?

To deploy a Laravel application on SiteGround, you can follow these steps:

  1. Login to your SiteGround account and navigate to the cPanel dashboard.
  2. Create a new subdomain or add-on domain where you want to deploy your Laravel application. This will create a new directory in your site's public_html folder.
  3. Install Git on your SiteGround server by navigating to cPanel's "Git Version Control" section and following the prompts.
  4. SSH into your SiteGround server using a tool like PuTTY or the built-in cPanel terminal.
  5. Navigate to the root directory of your domain using the "cd" command.
  6. Clone your Laravel repository into the subdomain or add-on domain directory using the following command: git clone
  7. Navigate to the application directory using the "cd" command, which would be something like: cd /path/to/your/website/public_html/subdomain_or_addon_domain_name
  8. Install Laravel dependencies by running the following command: composer install --no-dev
  9. Rename the .env.example file to .env and update the necessary environment variables such as database credentials.
  10. Generate the Laravel application key by running the following command: php artisan key:generate
  11. Set the proper file permissions for Laravel by running these commands: chmod -R 755 storage chmod -R 755 bootstrap/cache
  12. Run the migrations and seed the database if necessary using the following command: php artisan migrate --seed
  13. Ensure that the public_html folder of your domain points to the public folder of your Laravel application. You can use the cPanel's "Domains" section to do this.
  14. Verify that your Laravel application is now accessible by visiting your subdomain or add-on domain in a web browser.

That's it! Your Laravel application should be deployed and accessible on SiteGround.

What is the latest version of Laravel supported by SiteGround?

As of now, SiteGround supports Laravel 8.

What are the best practices for deploying Laravel on SiteGround?

Here are some best practices for deploying Laravel on SiteGround:

  1. Choose the appropriate hosting plan: SiteGround offers various hosting plans, including shared hosting, cloud hosting, and dedicated servers. Evaluate your requirements and choose a plan that best suits your needs.
  2. Enable PHP version compatibility: Ensure that your SiteGround hosting account has the latest version of PHP installed. Laravel requires PHP 7.3 or higher to run smoothly.
  3. Use Git for version control: Set up a Git repository for your Laravel application. This will help you manage code changes, collaborate with other developers, and easily deploy updates.
  4. Install Composer: Composer is a dependency management tool for PHP, and Laravel heavily relies on it. SiteGround allows you to install Composer globally on your server, enabling you to easily add Laravel packages or update dependencies.
  5. Enable SSH access: SiteGround offers SSH access, which is crucial for running Laravel commands and performing tasks like deploying updates, generating authentication keys, and running migrations.
  6. Configure environment variables: Laravel uses environment variables to store sensitive information, such as database credentials. SiteGround provides an interface to manage environment variables, allowing you to securely store and access such information.
  7. Use a reliable deployment strategy: SiteGround supports various deployment methods, including FTP, SFTP, Git, and Git Deployment. Choose a deployment strategy that best fits your workflow and ensures smooth and efficient deployment of your Laravel application.
  8. Set up cron jobs: Laravel relies on cron jobs for executing scheduled tasks. SiteGround allows you to easily set up cron jobs through cPanel, enabling you to schedule and automate tasks within your Laravel application.
  9. Optimize your application: SiteGround provides a range of performance optimization tools, including caching mechanisms, CDN integration, and server-level optimizations. Implement these optimizations to enhance the speed and scalability of your Laravel application.
  10. Implement security measures: SiteGround offers security features like SSL certificates, firewall protection, and regular backups. Enable these features to secure your Laravel application and protect it from vulnerabilities or attacks.

Remember to regularly update your Laravel application, dependencies, and server software to ensure stability, security, and access to the latest features.

What is the recommended deployment strategy for Laravel on SiteGround?

The recommended deployment strategy for Laravel on SiteGround is as follows:

  1. Set up a new shared hosting account on SiteGround.
  2. Install a fresh instance of Laravel on your local development environment.
  3. Connect to your SiteGround account using an FTP client (such as FileZilla).
  4. Upload your Laravel project files to the public_html directory on your SiteGround account.
  5. Create a new MySQL database on SiteGround and note down the database name, username, and password.
  6. Update the .env file in your Laravel project with the database details from SiteGround.
  7. Connect to your SiteGround account using SSH.
  8. Navigate to the public_html directory using the command cd public_html.
  9. Run the command composer install to install all the dependencies for your Laravel project.
  10. After the installation is complete, run the command php artisan key:generate to generate a new application key.
  11. Migrate the database tables using the command php artisan migrate.
  12. Finally, update the PHP version on SiteGround to match the Laravel requirements (preferably PHP 7.3 or higher).

This deployment strategy ensures that your Laravel application is securely hosted on SiteGround and accessible to users.

How to secure and protect the Laravel installation on SiteGround?

To secure and protect your Laravel installation on SiteGround, you can follow these steps:

  1. Update Laravel: Keep your Laravel installation up to date with the latest version. Laravel regularly releases security patches, so staying updated is crucial.
  2. Use Strong Passwords: Set strong passwords for your Laravel admin panel, database, and FTP account. Avoid using common or easily guessable passwords.
  3. Enable SSL: Install an SSL certificate on your site to encrypt the data transmission between the web server and clients. SiteGround provides free Let's Encrypt SSL certificates with their hosting plans.
  4. Secure Folder Permissions: Set appropriate file and folder permissions for your Laravel installation. Generally, folders should have permissions of 755, and files should have permissions of 644. You can use the following command in your terminal while inside the Laravel project folder to fix permissions: chmod -R 755 storage bootstrap/cache.
  5. Protect Sensitive Files: Ensure that sensitive files like .env and database configuration files are not accessible publicly. Move them to a non-public folder outside the site's web root directory.
  6. Use Firewall Protection: SiteGround provides a built-in web application firewall (WAF) to protect your site against common attacks. Enable it in your SiteGround hosting panel.
  7. Regularly Backup Your Site: Create regular backups of your Laravel site to ensure you have copies of your data. SiteGround offers automated backups, or you can use Laravel backup packages like spatie/laravel-backup.
  8. Enable Two-Factor Authentication (2FA): Enable 2FA for your Laravel admin panel and any relevant accounts associated with your Laravel installation. This adds an extra layer of security to protect against unauthorized access.
  9. Limit Access with IP Whitelisting: SiteGround allows you to whitelist specific IP addresses for access to your website. Limit access to only trusted IP addresses to reduce the risk of unauthorized access.
  10. Monitor and Update Dependencies: Regularly monitor and update the dependencies/packages used in your Laravel application. Outdated or vulnerable packages can pose a security risk.
  11. Implement Strong Validation and Sanitization: Ensure you validate and sanitize user input to prevent possible security vulnerabilities like XSS attacks or SQL injections. Laravel provides various built-in tools and methods to assist with this.
  12. Regularly Monitor Logs: Keep an eye on your Laravel application logs for any suspicious activity or error messages. Logs can indicate potential security breaches or vulnerabilities.

By following these steps, you can enhance the security and protect your Laravel installation on SiteGround.

Facebook Twitter LinkedIn Whatsapp Pocket

Related Posts:

To launch React.js on SiteGround, you can follow these steps:Access your SiteGround account: Log in to your SiteGround hosting account using your credentials. Create a new website: If you don't have an existing website, you need to create a new one. SiteGr...
Vue.js is a popular JavaScript framework that allows developers to build reactive and component-driven web applications. SiteGround is a web hosting provider that supports various technologies, including Vue.js. Running Vue.js on SiteGround involves a few step...
To launch Nuxt.js on SiteGround, you can follow these steps:Start by signing up for a hosting account with SiteGround. You can choose a plan that suits your requirements. After signing up, you'll receive an email with your account login credentials. Use th...
To publish Grafana on SiteGround, you can follow these steps:Access SiteGround Control Panel: Log in to your SiteGround account and access the control panel. Choose Web Hosting: From the control panel, select the web hosting service where you want to publish G...
To deploy Grafana on SiteGround, you can follow these steps:Log in to your SiteGround account and go to the cPanel. Look for the "Site Tools" section, and click on "Site Improvement Tools." Under "Security," click on "Git Version Co...
Installing Ghost on SiteGround involves a few steps. Here is a guide on how to do it:Start by logging in to your SiteGround account and navigate to the cPanel dashboard. Scroll down and under the "Autoinstallers" section, click on the "Ghost" i...