127.0.0.1和localhost在安装了macports的雪豹上有所不同

时间:2011-06-28 15:39:59

标签: apache apache2 osx-snow-leopard macports

在通过macports升级到最新的PHP之后,我一直在努力解决这个问题。虽然现在我有一个奇怪的问题,如果我访问 http://localhost - 这可以正确显示我的网站/ Users / foo / Sites中的网站列表 http://127.0.0.1 - 显示默认的“It Works”

我已经创建了一个带有以下

的vhost文件
 <VirtualHost *>
    DocumentRoot "/Users/foo/Sites"
    ServerName localhost
    ServerAlias 127.0.0.1
    ServerAdmin webmaster@foo.local
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /Users/foo/Sites>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    ErrorLog /opt/local/apache2/logs/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog /opt/local/apache2/logs/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@foo.local
    DocumentRoot "/Users/foo/Sites/snow"
    ServerName snow.local
    ServerAlias www.snow.local
    ErrorLog "/opt/local/apache2/logs/snow-error_log"
    CustomLog "/opt/local/apache2/logs/snow-access_log" common
</VirtualHost>

我的主机文件包含

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1          localhost 
fe80::1%lo0 localhost
127.0.0.1   snow.local

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

找到问题的答案。这是由于启用了“网络共享”设置而导致的。