What Server is Needed to Deploy Laravel Projects

One of the final steps in every web-project is deploying to live server. Often I see a problem when server is provided by the client from their hosting they had purchased long time ago, and it is not suitable for convenient Laravel deployment. So in this article I will make some recommendations for clients, what hosting to prepare.


Disclaimer: this article is my personal advice after 5 years working with Laravel. Other people may have different recommendations on the process of deployment, may have different preferences for servers or hosting, so this article is what works well for my team and my clients.


To understand what server we need, let’s recap how deployment works in Laravel:

  1. Code should be stored in repository, in a system like Github or Bitbucket
  2. Then developer needs to have SSH access to the server, connect and run a set of commands, like git clone to download the code to the server, and then some Laravel-related commands like composer install, artisan migrate and a few others, depending on the app details.
  3. Then, every time some new code changes are pushed to the repository, same procedure – SSH connect to the machine and running a few commands to pull the latest code version.
Typical composer install command

To perform that, the best option is to have a dedicated server with SSH access. Dedicated in this case means that it’s not shared with any other websites, so you can safely configure it, without breaking other projects.

Now, there are a few providers of dedicated servers tailored specifically to PHP projects, so they come with pre-installed software for PHP, MySQL database, Web-server like Nginx etc. These are mostly good for smaller projects:

So all you need, as a client, is to purchase a server (starting from $5/month) and give access to developer.

Digital Ocean Pricing
Digital Ocean Pricing

With server you will get its unique IP address, and then you should point your domain (yourdomain.com) DNS records to that IP address.

Another popular option is AWS (stands for Amazon Web Services) which provides many more Amazon tools for scaling the server, within Amazon ecosystem. It’s a better option for bigger projects, but it’s much more difficult to set up, and requires specific knowledge from a developer.

To recap, I recommend clients would choose one of those three providers above, my personal preference is Digital Ocean.


Why shared-hosting is bad for Laravel

Most popular and cheap hosting providers offer so-called “shared” hosting, which means your space on the server is shared with other customers, therefore you have limited access to configure it.

Shared-hosting is good for simple CMS sites based on WordPress or Drupal, but for custom Laravel apps it’s not enough. Here’s why:

  • Without SSH access developer can’t easily copy latest code with one command, uploading via FTP is unreliable and untraceable in case of errors
  • Some Laravel apps require specific software, PHP libraries, write permissions to some folders, additional settings. Quite often shared hosting restricts you from it.
  • You generally share resources with other hosting customers which may slow performance

I have a video-rant about it:


Tools for more convenient deployment

Developers can make their lives easier by using a few more tools for faster deployment.

1. Laravel Forge

Created by Laravel’s author Taylor Otwell himself, it’s an online tool that connects to your Digital Ocean account and does things like:

  • create new server
  • perform deployment with a click of a button, without doing SSH connect
  • set up auto deployment, which would be launched whenever new code is pushed to the repository

And many other things unrelated to deployment: SSL certificate installation, queue cron jobs management, error logging to Slack etc.

I’ve shot a video demo how Forge works, see here:


2. Laravel Envoyer

Also from the same author Taylor, another tool from Laravel ecosystem which allows you to pull the latest code changes without taking down your website. It’s so-called “zero time deployment”.

In general, deployment takes some time – pulling the code, running some scripts, clearing cache etc. Meanwhile, your web app is taken down with some maintenance page, or, even worse, it’s stay live to users and have unpredictable error messages. To avoid that, if you have more sensitive audience or higher traffic, I do advice Envoyer.

It also saves 5 previous deployment events, and allows you to rollback to previous deployments, in case something went wrong.

I also have a video for Envoyer, check this out.


Basically, that’s it about servers, deployment and additional tools.

To recap:

  • Don’t use shared-hosting
  • I recommend Digital Ocean hosting for smaller projects
  • My personal preference is using Laravel Forge to save more time

P.S. advice to developers: don’t do hosting yourselves, unless it’s part of your business. It’s a pretty hard work to guarantee 99.9% uptime, provide 24/7 support and just have anxiety waking up in the middle of the night when some site is down. And it’s not big revenue, just not worth the money. So let your clients purchase the hosting and servers.

Check out my new online course: Laravel Eloquent: Expert Level

3 thoughts on “What Server is Needed to Deploy Laravel Projects

  1. Imagine that from more than four years ago, I had able to install Python3 on my shared hosting account on HostMonster!
    Also, the aspect of updating code base, is not so critical, because in any case you have to implement a production version of the code, so simply, zipping, all code, then uploading the zipped archive to the host, then creating new folder on public_html folder and assigning a new sub-domain to it to have the contents of public folder of the Laravel project, then moving other directories away from public_html, is not a big problem using cPanel.

    However, indeed, the performance issue is the only real problem which may or may not face you with a shared host and it depends on the reputation of the hosting provider and the technical requirements of the application and the estimated traffic towards it .

    1. I agree that some shared hosting providers give more power than others.
      But, compare your process:

      – zipping all code,
      – then uploading the zipped archive to the host,
      – unzipping it, I assume?
      – then creating new folder on public_html folder
      – assigning a new sub-domain to it to have the contents of public folder of the Laravel project,
      – then moving other directories away from public_html

      Versus my method:
      – Do git push
      – Go to Envoyer.io and click Deploy now (if configured, you don’t even have to do that, it may be automated)
      – If you don’t have envoyer – ok, two actions: SSH into machine and do “git pull”

  2. For deploying Laravel projects, I would recommend using some cloud server, like DigitalOcean. However, if you don’t know how to setup DO server manually for Laravel, you can use Cloudways to launch Laravel server on DigitalOcean in just one click. The server will be managed by the platform provider. This will save a lot of your time.

Leave a Reply

Your email address will not be published. Required fields are marked *