Setting up Laravel on digitalocean Lemp 18.04

Here are the basic steps needed to setup the laravel framework on a digitalocean lemp doplet.

You need composer to be able to install laravel with composer:

apt install composer

You need to have zip/unzip commands, for composer to install the needed dependencies

apt install zip


For php you need the mbstring and xml extension installed

apt install php7.2-mbstring php7.2-xml

My default digitalocean vps had not enough swap memory, so I created some:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

When this is complete go to your webroot (/var/www) and create your laravel project:

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

Setup nginx to use your public folder as web root:

vi /etc/nginx/sites-enabled/digitalocean

in the file  look for root /var/www/html; & replace with: /var/www/yourporjectname/public;

restart nginx service:

service nginx restart


Leave a Reply

Your email address will not be published.