How to Run Nginx in WSL

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

You'll only receive email when they publish something new.

More from 19411
All posts