Support 24/7
Shared hostingManaged WordPressReseller hostingOpenClaw hostingVPS hostingDedicated serversManaged serversAbout usHow we compareRegionsKnowledge baseSupportDomainsSSLBlogClient area
VPS hosting
Knowledge base / VPS hosting

Setting up a Laravel Server on Debian 11

A step-by-step Laravel install on Debian 11: PHP, Composer, the web server, permissions and the .env file, with the commands to copy.

Last updated: September 16, 2026

Introduction

This article provides a step-by-step guide for beginners on installing and configuring Laravel - a popular PHP framework - on the Debian 11 operating system.

  1. 1Connect over SSHPuTTY on Windows, the terminal anywhere else.
  2. 2Update packages and install the basic toolsSteps 2 and 3.
  3. 3Install NginxThe web server that will serve the application.
  4. 4Install MySQL (Percona) and configure the clientSet the root password during installation, then store it in ~/.my.cnf.
  5. 5Install PHP-FPM and ComposerPHP-FPM processes the code, Composer manages the dependencies.
  6. 6Create the Laravel project, then point PHP-FPM and Nginx at itSteps 8 to 10, in that order.
The ten steps below, grouped. Nothing serves traffic until the last one — Nginx and PHP-FPM are configured for the project only after Laravel exists.

Step 1: Connecting to the Server

To begin, connect to your server via SSH. You can do this using a program like PuTTY for Windows, or directly through the terminal for macOS and Linux:

ssh your_username@your_server_ip

Step 2: Updating Packages

First, make sure all packages are updated to their latest versions:

sudo apt update && sudo apt upgrade

Step 3: Installing Basic Tools

Install necessary tools that will be useful for further work:

sudo apt install -y htop mc etckeeper fail2ban ufw curl gnupg2 ca-certificates lsb-release xfsprogs mdadm

Step 4: Installing Nginx

Install the Nginx web server, which will serve our Laravel application:

echo "deb http://nginx.org/packages/debian $(lsb_release -cs) nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt update
sudo apt install nginx

Step 5: Installing MySQL (Percona)

Install the MySQL database using Percona Server. During MySQL installation, set a password and choose the “Legacy” authentication method.

wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps80
sudo apt update
sudo apt install percona-server-server percona-server-common percona-xtrabackup-80

Step 6: Configuring MySQL Client

For ease of working with MySQL, set the password in the ~/.my.cnf file:

[client]
user=root
password=YOUR_PASSWORD

Step 7: Installing PHP-FPM and Composer

Install PHP-FPM for processing PHP code and Composer for managing dependencies:

sudo apt install -y php7.4-{,mysql,cli,common,fpm,curl,mbstring,zip,pdo,gd,mbstring,bz2,msgpack,redis,dom,opcache,xml,xsl,soap}
sudo apt install composer

Step 8: Installing Laravel

Create a new Laravel project:

composer create-project laravel/laravel your_project

Step 9: Editing the PHP-FPM Configuration File

Edit the file /etc/php/7.4/fpm/pool.d/www.conf, specifying the parameters:

user = your_user
group = your_user
listen.owner = your_user
listen.group = your_user
listen.mode = 0660

Where your_user is the username that will run the site. Restart php-fpm:

systemctl restart php7.4-fpm && systemctl enable php7.4-fpm

Step 10: Configuring Nginx for Laravel

Create a configuration file for your project:

sudo nano /etc/nginx/conf.d/your_project.conf

Add the following configuration:

server {
    listen 80;
    server_name your_domain_or_ip;
    root /var/www/your_project/public;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

Restart Nginx and add it to autostart:

systemctl restart nginx && systemctl enable nginx