127.0.0.1 和 localhost 在使用 macports 安装的雪豹上不同

发布于 2024-11-17 16:31:26 字数 1684 浏览 2 评论 0原文

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

我已经使用以下内容创建了一个虚拟主机文件

 <VirtualHost *>
    DocumentRoot "/Users/foo/Sites"
    ServerName localhost
    ServerAlias 127.0.0.1
    ServerAdmin [email protected]
    <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 [email protected]
    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

I have been trying to figure this out all day after upgrading to the latest PHP via macports. Although now I have a strange problem in that if I visit
http://localhost - this works correct displaying a list of websites in my sites /Users/foo/Sites
http://127.0.0.1 - this displays the default "It Works"

I havw I have created a vhost file with the following

 <VirtualHost *>
    DocumentRoot "/Users/foo/Sites"
    ServerName localhost
    ServerAlias 127.0.0.1
    ServerAdmin [email protected]
    <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 [email protected]
    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>

My host file contains

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帝王念 2024-11-24 16:31:26

I alwways have to go to http://localhost/~MY_USERNAME

一梦浮鱼 2024-11-24 16:31:26

找到了问题的答案。这是由于打开了“网络共享”设置造成的。

Found the answer to the problem. This was caused due to having the 'web sharing' settings turned on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文