I'm running Ubuntu 20.04 on WSL2 / Hyper-V / Windows 10.
When I do curl http://127.0.0.1
inside Ubuntu I get this back:
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.19.3</center>
</body>
</html>
When I do it on the host - on Windows 10 itself (with Git Bash) I get this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
How can I make port 80 accessible outside of Ubuntu? Do I need to update the firewall rules in Windows or something?
ifconfig
within WSL2 andipconfig
within Windows? As far as I know WSL is essentially a very lightweight virtual machine so a similar access method through the virtual network card should apply. Essentially you need the actual machine address as per the answer from Mark, and to ensure that firewalls are suitably permissive.