0

我正在尝试在我的 Mac OS 上构建一个虚拟主机,但它不起作用。

apache2/error_log 记录了以下消息

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Fri May 03 15:34:57 2013] [notice] Digest: generating secret for digest authentication ...
[Fri May 03 15:34:57 2013] [notice] Digest: done
[Fri May 03 15:34:58 2013] [notice] Apache/2.2.22 (Unix) DAV/2 configured -- resuming normal operations
[Fri May 03 15:35:16 2013] [error] [client 127.0.0.1] File does not exist: /usr/htdocs
[Fri May 03 15:35:16 2013] [error] [client 127.0.0.1] File does not exist: /usr/htdocs

浏览器返回这个....

Not Found

The requested URL / was not found on this server.

Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 with Suhosin-Patch Server at dev.myhost.test Port 80

我已经呆了很长时间试图解决这个问题。但是我没有成功...

这是我的 /etc/apache2/extra/httpd-vhosts.conf

NameVirtualHost *:80

<Directory "/Applications/XAMPP/htdocs/">
    Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory> 

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/htdocs/smileflame"
    ServerName dev.smileflame.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/htdocs/teste"
    ServerName dev.myhost.test
</VirtualHost>

接下来是我的 /etc/hosts

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

127.0.0.1  dev.myhost.test

我希望这个虚拟主机重定向到我的 index.php ......但这没有发生......有人知道为什么吗????

4

1 回答 1

0

不要/etc/hosts使用相同的 IP 进行两个条目。将别名放在同一行:

127.0.0.1       localhost dev.myhost.test
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
于 2013-05-05T02:31:02.713 回答