Search code examples
apacheapache2osx-snow-leopardmacports

127.0.0.1 and localhost different on snow leopard installed with macports


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

Solution

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