我正在开发网站,我想在我的 Nexus7 上预览来自本地主机的网站。
在我的 Ubuntu PC 上,我需要使用10.0.2.2而不是127.0.0.1让 Android 模拟器连接到运行在localhost. 那么想知道如何定义新IP?
我编辑了 /etc/hosts 并添加了
10.0.2.2 localhost
10.0.2.2 subdomain.localhost
Run Code Online (Sandbox Code Playgroud)
而是使用/etc/init.d/hostname.sh. 但是 ifconfig 仍然没有显示新的 ip。我怎样才能解决这个问题?
运行时:
wget https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb
Run Code Online (Sandbox Code Playgroud)
结果如下:
converted 'https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb' (ANSI_X3.4-1968) -> 'https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb' (UTF-8)
--2020-01-05 12:12:22-- https://gitlab.com/marsat/CTparental/uploads/35fd33508a49915869fa43820a7d2c36/ctparental_debian9_lighttpd_4.44.05-1.0_all.deb
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8080... failed: Connection refused.
Run Code Online (Sandbox Code Playgroud)
这里有几个关于服务器使用的问题,但我没有找到一个供客户端使用的。想要的文件存在于 gitlab.com 上,我可以通过浏览器下载它,没有任何问题。
我没有阻止任何事情的 iptables 规则:
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
这是我的网络配置:
ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet adr:192.168.0.xxx Bcast:192.168.0.255 Masque:255.255.255.0
adr inet6: …Run Code Online (Sandbox Code Playgroud) 我的本地主机(127.0.0.1)可以通过 Ping 访问,并且 wget 没有问题。
但是,当我尝试“telnet 本地主机”或“ftp localhost”时,连接被拒绝。我该如何解决这个问题?