How To PHP, MYSQL, NGINX & Composer in Windows 10/11 WSL Ubuntu

Step [1] – Installation NGINX

sudo apt install
sudo apt install nginx
sudo service nginx start

Step [2] – Create Virtual Host File magento.conf

sudo nano magento.conf && chmod 777 magento.conf
upstream fastcgi_backend {
  server  unix:/run/php/php8.2-fpm.sock;
}

server {

  listen 80;
  server_name www.magento-dev.com;
  set $MAGE_ROOT /var/www/html/magento2;
  include /var/www/html/magento2/nginx.conf.sample;
}

Step [3] – To Create nginx virtual host symbolic link

sudo ln -s /etc/nginx/sites-available/magento.conf /etc/nginx/sites-enabled/magento.conf

Step [4] – Inside /var/www/html/ below directory has been created

index.nginx-debian.html

Create magento2 folder

Step [5] – Go Windows > System 32 / Drivers / etc / host file

Set your virtual host here

Step [6]- Install PHP 8.3

sudo apt install php libapache2-mod-php php-bcmath php-curl php-fpm php-gd php-intl php-mbstring php-mysql php-soap php-xml php-xsl php-zip php-cli

Step [7] – Modify in php.ini file

To Find path of php.ini

php -ini | grep "Loaded Configuration File"
max_execution_time = 5000 

max_input_time = 5000 

memory_limit = -1

post_max_size = 900M 

upload_max_filesize = 900

Once all changes done in php.ini start php service below

sudo service php8.3-fpm start

Step [8] – Installation MYSQL

sudo apt install mysql-server

Step [9] – Start mysql Service

sudo service mysql start

Step [10] – Change Mysql Credentials

Mysql credentials as root / root123

Step [11] – Mysql Secure Installation

Step [12] – Create custom database with username / password

create database magento2461;

Create Mysql Username & Password to assign this database

create USER 'magento2461'@'localhost' IDENTIFIED  by 'TYfd1@#23asD';

Step [13] – Grant Permission assign database to user magento2461

Step [14] – Run flush privileges command

flush privileges;

Step [15] – Composer Installation

sudo curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php –install-dir=/usr/local/bin –filename=composer

To Check either composer working fine

Step [16] – Remove composer-setup.php

Once installed composer, It is file composer-setup.php created, we do not need this file, need to remove

Step [17] – Elastic Search Installation

sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-amd64.deb

sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-amd64.deb.sha512

shasum -a 512 -c elasticsearch-8.3.2-amd64.deb.sha512
sudo dpkg -i elasticsearch-8.3.2-amd64.deb

Once Below command run & display as ok — Elastic Search packaged installed.

shasum -a 512 -c elasticsearch-8.3.2-amd64.deb.sha512

Step [18] – Elasticsearch Start command

 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
 sudo systemctl start elasticsearch.service

Leave a Reply

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