How to Install Laravel Framework on Debian 11

 

 

Laravel is a popular PHP framework that makes web application development easy and enjoyable. This guide will walk you through the steps to install Laravel on a fresh Debian 11 server.

Step 1: Update Your System

Before starting the installation, ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install PHP and Required Extensions

Laravel requires PHP 7.4 or higher. Install PHP and the necessary extensions:

sudo apt install php php-cli php-mbstring php-xml php-curl php-zip php-gd php-mysql -y

Step 3: Install Composer

Composer is a dependency manager for PHP. Install it using the following commands:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Step 4: Install Laravel

Now you can install Laravel. Navigate to your web server’s root directory (usually /var/www/html) and create a new Laravel project:

cd /var/www/html
composer create-project --prefer-dist laravel/laravel myproject

Step 5: Set Permissions

Set the necessary permissions for the Laravel directory:

sudo chown -R www-data:www-data /var/www/html/myproject
sudo chmod -R 755 /var/www/html/myproject

Step 6: Configure Your Web Server

If you are using Apache, create a new configuration file:

sudo nano /etc/apache2/sites-available/myproject.conf

Add the following configuration:

<VirtualHost *:80>
    ServerName your_domain.com
    DocumentRoot /var/www/html/myproject/public

    <Directory /var/www/html/myproject/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/myproject-error.log
    CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined
</VirtualHost>

Enable the new site and the rewrite module, then restart Apache:

sudo a2ensite myproject
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 7: Access Your Laravel Application

Open your web browser and navigate to http://your_domain.com to see your Laravel application in action!

Conclusion

You have successfully installed the Laravel framework on Debian 11. This framework will help you build modern web applications quickly and efficiently.

If you're looking for a reliable hosting solution for your Laravel applications, consider using Windows VPS UK. With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need VPS UK Windows or Windows Virtual Private Servers, you'll find a solution that fits your requirements.

For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your needs.

  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

Boost Your Ubuntu System's Performance with a Swap File: A Step-by-Step Guide

What is a Swap File? A swap file in Ubuntu serves as dedicated virtual memory on your hard...

How to Migrate ISPConfig 2, ISPConfig 3.x, Confixx, CPanel or Plesk to ISPConfig 3.2 (single server)

Introduction Migration from other control panels like ISPConfig 2, ISPConfig 3.x, Confixx,...

How to Install and Configure Zabbix Server and Client on Rocky Linux 9

Introduction Zabbix is an open-source monitoring solution that provides real-time...

How to Install CockroachDB Cluster on Debian 12

Introduction CockroachDB is a distributed SQL database built to handle large-scale,...

How to Install Joomla with Apache and Let's Encrypt SSL on AlmaLinux 9

Introduction Joomla is a popular open-source content management system (CMS) used to build...