How to run PHP Laravel Application in Ubuntu server

In this tutorial we’ll cover how to launch ready-to-use Laravel application in Ubuntu VPS.

First of all, we’ll need to install some software (you can use something like Digital Ocean presets – in such case this software could be already installed):

Now we have to add a user to run our PHP-fpm instance. Also we’ll keep all application files in this folder:

Now it’s time to setup our PHP-fpm config to use this user:

And restart FPM:

We just got PHP configured, so it’s time to configure nginx:

And now we have one more step – database configuration (use mysql password you set during the installation):

Create the database and user for our app:

The last thing is nginx restart:

Now it’s time to logout from server and login again using the app user.
First of all, install composer:

Than place the application source into /home/app/YOURPROJECTNAME folder, than enter it and make a copy of .env.example file (if it’s not provided, you can ask your app developer to provide it) with then .env name and set your database credentials. Your app provider could ask you to setup more items in this file – please ask him for details. Once you’ll finish the .env setup, please run the following commands:

This will install all composer dependencies and run all database migrations. Last command will seed your database. This step is optional and depends on app developer, for example using my restaurant Ionic starter, you’ll create the default admin panel user with seed command.

Everything is done now, so your app should become available via HTTP.

Leave a Reply

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