Last Updated: September 07, 2017
· aalaap

Setting up a Laravel 5.4 app on WebFaction

It's 2017 and there's still no updated, easy guide to setting up a Laravel 5.4 app on WebFaction. So I decided to write one.

It's actually pretty easy.

SSH into your WebFaction server.

  1. In your home directory (/home/username/), create another directory called apps. It can be anything, but it's going to hold our Laravel (or other) apps, so I'm calling it that.
  2. Clone your repo into /home/username/apps/, so an example app becomes /home/username/apps/laraveltest.
  3. Run alias php=php56 to prevent it from running PHP 5.2 by default.
  4. In your apps directory, follow the instructions on the Composer installer website to get composer.phar. Set up an alias for this too: alias composer=php ~/apps/composer.phar
  5. Run composer install in the laraveltest directory and set things up.

Log into your WebFaction dashboard.

  1. Set up a new application of category "Symbolic link".
  2. Set the app type to "Symbolic link to static/cgi/php56 app". You can use PHP 7 if you have a newer server, but remember to make relevant changes in the previous steps too.
  3. Put the path of the public directory of your Laravel app as follows: /home/username/apps/laraveltest/public.
  4. Now simply create an entry under domains and websites (a website = a domain + an application) and open the URL in the browser.

If everything works out, you can automate step one so it checks out the latest and installs it after you push to master.

This guide was based upon an older one, which has been the guide I've always referred to: https://frontiernxt.com/deploying-a-laravel-app-to-webfaction-using-bitbucket