Vhost Config issues

Ryan Schmidt ryandesign at macports.org
Fri Sep 3 02:03:55 PDT 2010


On Sep 3, 2010, at 03:54, Jasper Frumau wrote:

> I still have issues with my MacPorts Lamp since I started playing with virtual hosts. In /etc/HOSTS I have these:
> 
> ##
> 127.0.0.1    localhost
> 127.0.0.1       jaspersmbp
> 127.0.0.1       dev-wordpress.com
> 255.255.255.255    broadcasthost
> ::1             localhost 
> fe80::1%lo0    localhost
> 
> 
> When I go to dev-wordpress.com I am sent to localhost page saying it works (/opt/local/www/index.html)
> When I go to localhost I am sent to the same page saying it works (/opt/local/www/index.html)
> 
> In /opt/local/apache2/conf/extra/vhosts I have template.txt to use as a vhost template and wordpress.conf with:
> 
> $ cat  wordpress.conf
> # START example.com
> <VirtualHost *:80>
>        DocumentRoot "/opt/local/www/wordpress/"
>        ServerAdmin user at example.com
>        ServerName dev-wordpess.com
>        ServerAlias www.dev-wordpress.com
>        DirectoryIndex index.php
> 
>        # php setttings
>       # php_admin_value open_basedir "/opt/local/www/clients/last.first/example.com/:/private/var/tmp/:"
>        #php_value engine off
> 
>        <Directory "/opt/local/www/wordpress/">
>                Options FollowSymLinks
>                AllowOverride All
>                Order allow,deny
>                allow from all
>        </Directory>
> </VirtualHost>
> # END example.com

And somehow you are asking for Apache to include everything in the extra/vhosts directory?

You need to define a default vhost as the first vhost it loads. That means, if you're automatically loading everything in extra/vhosts, write a file which will sort first alphabetically and set up your default vhost in that. Or define the default vhost directly in httpd.conf.



> I think I should different ips per setup on my localhost, which I will try shortly, but I think I have mistakes in my vhost setup as well. Any help would be appreciated...

You can use IP-based virtual hosting if you want, but there's no need to; name-based virtual hosting works fine if you set it up correctly, which isn't hard to do.




More information about the macports-users mailing list