How to Install Joomla on Windows 10 WSL With Nginx

How to Install Joomla on Windows 10 WSL With Nginx

This post shows how to install Joomla on Windows 10 WSL (Windows Subsystem for Linux) with Nginx HTTP server on Ubuntu 18.04 | 20.04.

Joomla is a free, open-source and powerful web content management system which is used for publishing web content on websites. It is allow you to build mobile-ready and user-friendly websites and powerful online applications. It is written in PHP programming language and distributed under the GNU General Public License version 2 or later

For more details about Joomla, please check its official website.

With the help of WSL, you can easily install full Linux operating system in your Windows 10 system. You just need to enable WSL (Windows Subsystem for Linux) in your Windows, install a Linux OS, install and run Joomla.


How to Install Joomla on Windows 10 WSL

Simply follow below steps to install Joomla on Windows 10 WSL with Nginx :

Step 1 : Enable WSL in Windows 10

First of all, you will need to enable WSL in your Windows system. To enable it, simply open PowerShell terminal as administrator.

Click on Start icon -> search for PowerShell -> right-click Windows PowerShell app -> choose to run as administrator.

Run-powershell

Next, run the command below in the Windows PowerShell console as show below:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

The command above will display a successful message similar as below:

Deployment Image Servicing and Management tool
Version: 10.0.19041.844

Image Version: 10.0.19042.985

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Step 2 : Enable Virtual Machine Platform

Run the commands below from the same PowerShell console to enable the Virtual Machine platform in your Windows system:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you have Windows 10 version lower than 2004 in your system, use the commands below:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

Next, restart your computer for changes to apply. If you forget to start then the below command doesn’t work.

After restart of your computer, launch the PowerShell as administrator again and run the commands below to set WSL 2 as the default version of WSL:

wsl --set-default-version 2

Step 3 : Install Ubuntu in Windows 10

At this stage, WSL 2 is installed and ready to be used. So now you can easily install Linux operating system in your Windows 10 system.

Click the below button to download and install Ubuntu 20.04 LTS from Microsoft Windows store.

download-ubuntu

Click on the Get button to Download and Install Ubuntu. After installing Ubuntu, launch it from WSL environment.

After launching, it will install and prompt to create your account as show below :

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: studiesonline
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Use some troubleshooting commands when you get issues above. Run the below troubleshooting commands and launch Ubuntu again:

wsl --set-default-version 1
bcdedit /set hypervisorlaunchtype auto start

Step 4 : Install Nginx HTTP Server

To install Nginx HTTP on your Ubuntu server, run the commands below.

sudo apt update
sudo apt install nginx

Next, run the commands below to stop and start Nginx services:

sudo service nginx stop
sudo service nginx start

For check if Nginx server is installed or not, simply open your browser and type server IP or hostname.

If browser show result similar like below then Nginx is installed and working properly.

http://localhost
nginx_default

Step 5 : Install MariaDB Server

You will also need a database server to run Joomla and store its content. MariaDB database server is an open source, fast and secure database server that you can use with Joomla.

To install MariaDB database server, simply run the commands below:

sudo apt update
sudo apt install mariadb-server mariadb-client

Next, run the commands below to stop, start and enable MariaDB service to always start up with the server boots:

sudo service mysql stop
sudo service mysql start

Now, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When you run the above command, it will prompted to answer the questions as show below:

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

For check if MariaDB is installed and working, run the command below:

sudo mysql -u root -p

When prompted, type the root password.

check-mariadb

Step 6 : Install PHP and Related Modules

Joomla is completely based on PHP programming language, so PHP is must required to run Joomla. To install PHP and related modules, run the command below:

sudo apt install php-fpm php-common php-mysql php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-xml php-cli php-zip

After installing the PHP and its related modules, run the command below to open PHP default config file and configure some basic settings:

sudo nano /etc/php/7.4/fpm/php.ini

Change the below setting in the configuration file and save it:

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

These above lines are good settings to configure for most Joomla sites.

Next, runt the command below to stop and start PHP7.4 services:

sudo service php7.4-fpm stop
sudo service php7.4-fpm start

Step 7 : Create Joomla Database

To create Joomla database, first you will need to create a blank database for Joomla. Simply run the command below to logon to MariaDB database server:

sudo mysql -u root -p

Next, create a database named  joomladb using command below:

CREATE DATABASE joomladb;

Now, run the command below to create a database user named joomladbuser :

CREATE USER 'joomladbuser'@'localhost' IDENTIFIED BY 'your_new_password_here';

Grant the newly created database user to the database by using command below:

GRANT ALL ON Joomladb.* TO 'Joomladbuser'@'localhost' WITH GRANT OPTION;

Next, save your changes and exit:

FLUSH PRIVILEGES;
EXIT;

Step 8 : Download Joomla

To download the latest version of Joomla, run the command below:

cd /tmp
wget https://downloads.joomla.org/cms/joomla3/3-9-27/Joomla_3-9-27-Stable-Full_Package.zip
sudo unzip -d /var/www/joomla /tmp/Joomla_3-9-27-Stable-Full_Package.zip

To check the Joomla latest stable releases, visit its official releases page.

After that, you will need to allow www-data user to own the Joomla directory by using command below:

sudo chown -R www-data:www-data /var/www/joomla/
sudo chmod -R 755 /var/www/joomla/

Step 9 : Configure Nginx For Joomla Site

To configure Nginx for Joomla site, create a new VirtualHost file named joomla in the /etc/nginx/sites-available/ directory by running the commands below:

sudo nano /etc/nginx/sites-available/joomla

After create file, copy and paste the below content into the configuration file and save it. Replace the highlighted line with your own domain name :

server {
    listen 80;
    listen [::]:80;
    root /var/www/joomla;
    index  index.php index.html index.htm;
    server_name  example.com www.example.com;

    client_max_body_size 100M;
    autoindex off;

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

    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*.(php|pl|py|jsp|asp|sh|cgi)$ {
      return 403;
      error_page 403 /403_error.html;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save the file and exit.

Next, run the command below to enable the new site:

sudo ln -s /etc/nginx/sites-available/joomla /etc/nginx/sites-enabled/

Restart the Nginx using command below:

sudo service nginx restart

Step 10 : Launch Joomla

At this stage, Joomla is installed and ready to use. To launch it, open your favorite web browser and browse to the server domain name http://example.com.

http://example.com

It will open the Joomla setup wizard screen. At this screen, type site name, create an admin account and click on next button to continue:

joomla-setup-wizard

Next, provide the database information that created in above steps:

install Joomla on Windows 10 WSL-data-base-details-joomla

Finally, check the all details and click on the  Install button to complete the installation process.

install Joomla on Windows 10 WSL-finalization-joomla-setup

Login with the admin account created above and enjoy Joomla.


That’s all

If you face any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top