Finally! Time to push my Laravel project to a live server. I knew this was going to be quite a process so I was pushing it off until I had time to dedicate to it.

Setting up Ubuntu, Nginx, Laravel on a Vultr Server

I am not going to write up an entire explanation because mostly I followed this very well written guide here:

Updating to PHP 7.2

Unfortunately I realized I needed PHP 7.2 for my app and the server had 7.0. (In hindsight I probably should have chosen Ubuntu 18.) I found this guide for updating the PHP version:

sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm

I had to update some additional PHP modules as well:

sudo apt install 7.2-zip php7.2-mbstring php7.2-mysql php7.2-gd

To update the Nginx config to point to the 7.2 socket you need to edit the default file and change one line:

sudo nano /etc/nginx/sites-available/default


When it was all set I followed the instructions for removing the PHP 7.0 version but something went awry and deleted more than it should. I had to re-install some things but finally it was all running properly!

Domain Name Server

Pointing my domain name to my new server was easy with Vultr:

File Permissions

And then here’s when the fun started. I ran into file permissions errors. At first glance on google there are obvious steps to take, which solved some – but not all – of my errors. It was really frustrating because it worked perfectly fine in local development but was failing on file upload in production.

Here’s what I learned.

First, make sure to set the storage link on the production server:

php artisan storage:link

Second, don’t ever set a folder permission to 777 like half of the google results say to. It should be set to 775:

sudo chmod -R 775 /var/www/laravel/storage

Unfortunately I still had one file upload section that wasn’t working – but the others were! After reading many ideas and trying various things what finally worked for me was changing the ownership of the folders to www-data, which is the user that fps uses:

sudo chown -R www-data:www-data /var/www/laravel/storage

After all of that I discovered that some of my code had a bug in it – of course – but was otherwise working! Next time I will write about using Image Intervention for saving the images.