How to Install Laravel on Debian 9

In this 7-step guide, we will show you how to install Laravel on Debian 9. We’ll install Laravel together with PHP-FPM and Nginx. Laravel is a next generation of PHP framework, and it’s the most popular open-source PHP framework lately. It is intended for the modern, rapid development of web applications, following the MVC model. Installing Laravel (The PHP Framework For Web Artisans, its how they called it) on Debian 9 is an easy task and it should take few minutes to finish it. This guide should work on other Linux operating systems, but was written and tested for Debian 9. Let’s get started!

1. Update the system and install necessary packages

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl

2. Install PHP and required PHP modules

To install the latest stable version of PHP version 7.0 and all necessary modules, run:

5. Server your application with Artisan serve command

Once the installation is completed you can use the artisan serve command to serve your application:

php artisan serve

The output should be something like this:

Laravel development server started: <http://127.0.0.1:8000>

You can now open your browser and access your new Laravel installation at: http://127.0.0.1:8000

6. Install and configure Nginx and PHP FPM

PHP’s built-in server is good for development but for production sites you will need to use a real web server such as Nginx or Apache. In this part of the tutorial, we will show you how to install and configure both, Nginx and PHP FPM to serve your Laravel application.

Run the following command to install both Nginx and PHP-FPM from the official Debian repositories:

7. Test Nginx configuration

Test the Nginx configuration and restart the Nginx service with the following commands:

sudo nginx -t
sudo service nginx restart

This was the last step, you have successfully installed Laravel on your Debian 9 VPS. For more information about how to manage your Laravel installation, please refer to the Laravel website.

If you are one of our web hosting customers, and use our optimized Laravel Hosting, you don’t have to install Laravel on Debian 9, our expert Linux admins will setup and optimize your Laravel VPS, for you. They are available 24×7 and will take care of your request immediately. As a Laravel developer, you should be focusing on Laravel development and improving your code and leave the server work to us.

PS. If you liked this post, on how to install Laravel on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.