从外部访问python SimpleHTTPServer虚拟框

问题描述:

我在虚拟框中运行python SimpleHTTPServer。可以从主机访问它吗? 在我的主机上运行ipconfig给了我下面的地址。我试图在我的主机浏览器中使用它,但似乎没有工作。 我应该看看不同的IP地址吗?从外部访问python SimpleHTTPServer虚拟框

$> ipconfig 

    Windows IP Configuration 


    Ethernet adapter Ethernet 2: 

     Media State . . . . . . . . . . . : Media disconnected 
     Connection-specific DNS Suffix . : 

    Ethernet adapter VirtualBox Host-Only Network #2: 

     Connection-specific DNS Suffix . : 
     Link-local IPv6 Address . . . . . : xx:xx:xx:xxxx:xxx:xxxx 
     IPv4 Address. . . . . . . . . . . : 192.168.99.1 
     Subnet Mask . . . . . . . . . . . : 255.255.255.0 
     Default Gateway . . . . . . . . . : 
+0

确保你使用正确的端口 – njzk2

+0

你需要在虚拟机配置中使用桥接adaper(可能)...然后使用该ip地址... –

+0

@ njzk2我正在使用8000,默认打开它。那是对的吗? –

虚拟盒子中的端口转发帮助解决了这个问题。