【发布时间】:2015-08-09 23:05:00
【问题描述】:
这是过去几天一直困扰我的情况。我在我的 etc/hosts 文件中设置了很多开发环境子域,就像这样......
127.0.0.1 localhost
127.0.0.1 sub.localhost
127.0.0.1 another.localhost
127.0.0.1 andanother.localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
然后在我的 Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 文件中指定,像这样...
NameVirtualHost *:80
NameVirtualHost sub.localhost:80
NameVirtualHost another.localhost:80
NameVirtualHost andanother.localhost:80
<VirtualHost *:80>
DocumentRoot "/Users/johndoe/websites"
ServerName localhost
</VirtualHost>
<VirtualHost sub.localhost:80>
DocumentRoot "/Users/johndoe/websites/sub"
ServerName sub.localhost
</VirtualHost>
<VirtualHost another.localhost:80>
DocumentRoot "/Users/johndoe/websites/another"
ServerName another.localhost
</VirtualHost>
<VirtualHost andanother.localhost:80>
DocumentRoot "/Users/johndoe/websites/andanother"
ServerName andanother.localhost
</VirtualHost>
最近他们都停止在 Chrome 中工作(Firefox 和 Safari 工作得很好)。我的所有 localhost 子域都开始出现 404 错误。
- 在 etc/hosts 中编辑/更改设置无效
- 编辑/更改我的 httpd-vhosts.conf 文件中的设置不起作用
我只是想不通为什么 Chrome 没有将这些地址解析到我本地机器上的那些目录。
.
【问题讨论】:
-
从 3 天前开始,我在使用 chromium 43 的 Ubuntu 上遇到了同样的问题。
标签: macos apache google-chrome localhost mamp