How to Run Nginx in WSL
July 4, 2023•90 words
Nginx won’t run in CentOS build for WSL, because CentOS is using systemctl and it relies on Linux ‘init‘ but in WSL it is Microsoft init.
Use Ubuntu, this distro is default and popular for WSL, together with having the service management command named ‘service‘ instead of ‘systemctl’ which doesn’t require Linux ‘init‘.
Install Nginx in Ubuntu WSL:
sudo apt install nginx -y
Start Nginx:
sudo service nginx start
Restart Nginx:
sudo service nginx restart
Stop Nginx:
sudo service nginx stop