Laravel on Digital Ocean

Updated Jun 9, 2020・1 minute read Post By Dev Dojo
Laravel on Digital Ocean

Setting up your Laravel site on Digital Ocean is not as easy as it may seem. Recently I setup a new LEMP server and had to install a bunch of libraries and configs... It was to say the least, kind of a headache.

Now, thanks to Larasail, this will be a thing of the past. You can check out the repo here:

Larasail is a CLI tool to help you Sail the Servers of Digital Ocean. Getting started is super easy. Simply boot up a new Ubuntu server in your Digital Ocean account:

Then SSH into that server and add the command:

curl -sL | tar xz && source larasail-master/install

And you'll see a screen that looks similar to the following:

Next, we can setup our new Laravel server using the setup command like so:

larasail setup

And this step will probably take at least a couple minutes to install Nginx, PHP, MySQL, and all the necessary files.

After you've setup your new server you will have a bunch of tools available for you to use:

  • The Composer Command
  • The Laravel Command
  • The Larasail Commmand

If you want to setup a new laravel site you can use the laravel new command inside of your /var/www directory, or you can clone your existing laravel app into that directory.

Need to create a new host? Simple :)

To setup a new site and host you can run the following command:

larasail host /var/www/mywebsite

This command will create a new nginx host that will listen for a connection coming from and map it to the /var/www/mywebsite/public folder.

Now, with LaraSail you can easily spawn up new Laravel apps with the drop of a hat. Make sure to check out the repo for more options:

© 2020 DevDojo LLC. All rights reserved.