How to set up a Linux web server locally in a window in Windows 11

In an ever-changing digital world, the need to test web applications locally on a server is increasingly crucial for developers. Thanks to technological advances, it is now possible to run Linux applications directly on your Windows 11 machine thanks to the Windows Subsystem for Linux (WSL). This guide shows you step by step how to install and configure a Linux web server locally.

Understanding the Windows Subsystem for Linux

What is WSL?

THE Windows Subsystem for Linux allows Windows users to run a Linux distribution using the Windows infrastructure. This opens up many development possibilities, including creating and testing web applications using technologies such as PHP, MySQL And Apache.

Why use WSL?

Using WSL has several advantages:

  • Easy access to Linux development tools
  • Perfect integration with your Windows system
  • Fast application execution without heavy virtual machines

Install WSL on Windows 11

Install WSL on Windows 11

Step 1: Enable WSL

To install the Windows Subsystem for Linux, you must first enable it in Windows settings. Follow these instructions:

  1. Open Command Prompt in administrator mode.
  2. Run the command wsl –install.
  3. Restart your computer to complete the installation.

Step 2: Install a Linux distribution

Once WSL is enabled, you can install a Linux distribution via the Microsoft Store. Choose for example Ubuntu Or AlmaLinux. These distributions are commonly used in the server world.

Configure the local web server

Step 3: Install the Necessary Components

To configure your web server, install the following components in your Linux terminal:

Step 4: Start Apache Server

After installation, the Apache server must be started. Run the following command:

Additional essential settings

Additional essential settings

Configure file access from Windows

It is crucial to ensure that you can access your project files from Windows. You can do this by setting permissions on the appropriate folder. Use the command:

Summary of key information

🖥️ Stage 🛠️ Description
Installing WSL Enable Windows Subsystem for Linux.
Installing a Distribution Choose a Linux distribution from the Microsoft Store.
Install Apache Configure Apache with PHP and MySQL.
Start the server Enable Apache server via command.
Access files Configure permissions to use Windows Explorer.

Use your server locally

Access your website

Once your server is running, you will be able to access your site locally via a browser by entering http://localhost. You can also manage your databases with tools like PhpMyAdmin.

Please leave your comments below if you have any questions or want to share your experience setting up your local web server!