You have to find the IP address of the virtual machine powering your Linux distribution with: ip addr | grep eth0 as shown in Accessing network applications with WSL | Microsoft Docs and use this address instead of localhost.
Topic on Manual talk:Running MediaWiki on Windows Subsystem for Linux
Appearance