In this tutorial we will show you how to install Laravel on Debian 9. For those of you who didn’t know, For those of you who didn’t know, Laravel is a free, open-source PHP web application framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern. It is a pretty new framework, but with a big potential to become one of the most popular PHP frameworks.
This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Laravel on a Debian 9 (Stretch) server.
Install Laravel on Debian 9 Stretch
Step 1. Before we install any software, it’s important to make sure your system is up to date by running these following apt-get commands in the terminal:
Step 2. Installing Composer.
Install Composer which is the tool for dependency management in PHP:
curl-sShttps://getcomposer.org/installer | php
Install the latest version of Laravel, using the composer create-project command:
If the installation is successful, you will see the following lines:
Once the installation is completed you can use the artisan serve command to serve your application:
The output should be something like this:
Run the following command to install both Nginx and PHP-FPM from the official Debian repositories:
Next, change the ownership of the Laravel directory:
Then, create a new Nginx server block with the following content:
### nano /etc/nginx/sites-available/mydomain.com
Activate the server block by creating a symbolic link:
Now, we can restart Nginx web server so that the changes take place:
Congratulation’s! You have successfully installed Laravel. Thanks for using this tutorial for installing Install Laravel on Debian 9 Stretch system. For additional help or useful information, we recommend you to check the official Laravel web site.