在 /etc/hosts 中:
10.0.11.162 mpcore.bts.md mpcore
127.0.0.1 localhost.localdomain localhost
::1 mpcore localhost6.localdomain6 localhost6
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
/etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
/etc/网络/接口
auto eth0
iface eth0 inet static
address 10.0.11.162
netmask 255.255.255.0
network 10.0.11.0
broadcast 10.0.11.255
gateway 10.0.11.1
因此,当我使用 IPhttp://10.0.11.162我得到了 index.html
但是当我使用http://mpcore.bts.md我收到“未找到服务器”错误
答案1
您的服务器配置没有问题。问题是mpcore.bts.md根本不存在,无论是在 DNS 中还是在 hosts 文件中。
请记住,您的服务器/etc/hosts
仅适用于在该服务器上运行的程序。如果您尝试从其他计算机连接,则不能查看服务器的hosts
文件,仅限其自己的。