WSL2 now supports connecting Localhost from Windows 10 applications
Windows 10 Insider build 18945 has just been released by Microsoft with many noticeable improvements, including Windows Subsystem for Linux version 2 (WSL2) that has been integrated with support for seamless connectivity. Directly, Windows 10 applications with WSL2 applications via localhost.
- Live Tiles will really go into oblivion if the Windows 10 20H1 Start Menu looks great like this
Localhost has now been added back to WSL2
When WSL2 was released with the first version, the tool no longer supported the ability to connect to Linux WSL2 servers from Windows 10 applications using localhost addresses. Therefore, in case you want to connect to the WSL2 application from your Windows applications, you will have to find the IP address assigned to the running Linux distribution and connect to it as an alternative.
As for the version of Windows 10 Insider build 18945, the localhost feature has now been added back to WSL2, and you can connect directly to Docker, NPM or other services running locally on the system through Localhost. This task can be performed using the command nc as shown in the example below.
- Appeared to design Microsoft's new Action Center, the corners are more elegant and modern
Connect via Localhost
With the 're-export' of the localhost feature, users can now fully enjoy the benefits from the increase in performance of WSL2, while still easily accessible to any Linux server. Which they are running.
Link servers to 0.0.0.0 so that localhost works
Some users said they had trouble activating the localhost feature in WSL2 because their server is bound to 127.0.0.1.
The engineer responsible for WSL program manager Craig Loewen stated in a post of the WSL2 error message on the blog that in order for localhost to work, the server needs to be able to access all IP addresses, and therefore limited to 0.0.0.0. Originally written by Craig Loewen as follows:
"Can you check which IP address your php object is bound to? I suspect that it only accepts connections from localhost (127.0.0.1), while also requiring acceptability. The connections come from all IP addresses (for example, link it to 0.0.0.0) so you will need to run the command:
php -S 0.0.0.0:8000 '.
For example, users have reported that they cannot let PHP work on localhost with the
php -S localhost: 8000 command. This may be because the HOSTS file maps localhost to a specific loopback 127.0.0.1 address and therefore this feature will not work.
- Microsoft releases a new Windows 10 update, Microsoft Edge will be hidden if you install Edge Chromium
Distribution server file WSL2 (WSL2 File Hosts File)
When users bind PHP with 0.0.0.0, use the
php -S 0.0.0.0:8000 command, the localhost connection will most likely work properly.
- How to mount a Linux file system using WSL2 on Windows 10
- Instructions for installing WordPress on localhost - Part 2
- Why is Localhost's IP address 127.0.0.1?
- Microsoft will release Linux 'genuine' Linux kernel with Windows 10 WSL
- Instructions for installing WordPress on localhost - Part 1
- How are Linux kernel updates distributed on Windows Update?
- How to change SDR and HDR light balance in Windows 10
- What is special about connecting Windows 10 with Microsoft's iPhone?