我在我的笔记本电脑上设置了虚拟主机,我知道它可以正常工作,因为我经常将它们用于工作和学校,但是无论出于何种原因,当我在父母家里连接到他们的家庭网络时,我都会收到 404'd。如果我从网络断开连接,我会得到 Apache 为页面提供的服务。这是我的 httpd.conf 文件内容(仅处理虚拟主机的部分):
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/kyle/Sites/ESA/app/public"
ServerName esa.loc
<Directory "/Users/kyle/Sites/ESA/app/public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/kyle/Sites/portfolio-site/public"
ServerName kyle.loc
<Directory "/Users/kyle/Sites/portfolio-site/public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
和我的 /etc/hosts 文件:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost esa.loc kyle.loc
255.255.255.255 broadcasthost
::1 localhost esa.loc kyle.loc
fe80::1%lo0 localhost esa.loc kyle.loc
如果您需要更多信息,请告诉我,我会尽力提供。谢谢。
编辑:忘了提到我尝试将我的笔记本电脑添加到路由器上的 DMZ 中,但这并没有解决问题。