You need to update you httpd-vhosts.conf
to something like this:
<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/www.site1.dev"
ServerName www.site1.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/www.site2.dev"
ServerName www.site2.dev
</VirtualHost>
Having each domain separately in your config allows you to have separate server options for each, e.g. Rewrite config, separate log files, etc.
Then, update your /etc/hosts
and add this at the end:
127.0.0.1 www.site1.dev
127.0.0.1 www.site2.dev
This step is particurarily important as this is where your OS looks first when resolving domain names. Otherwise it will not know what www.site1.dev is.
Then simply restart the server by disabling Web Sharing and enabling it again.
To make sure your config works you can check apache logs (access_log
and error_log
) via Console.app (Files > /private/var/log > apache2).
I've done some experimentation in order to answer my own question...
Firstly, I've only gotten the virtual named host kludge working with Passenger, not the new Lion scheme, but hey, it's a start...
Firstly, follow the Apple temporary fix, as linked in the question.
Then, the following works for me to support two virtual named hosts, implemented using Passenger and Rails. I derived this by taking the Lion virtual host example, and merging in my Snow Leopard config.
Disclaimer this works, but needs improvement. I've not got SSL working yet.
Add the following in a file named 0000_any_80_.conf
## Example Virtual Host Configuration
<VirtualHost *:80>
ServerName bongle.example.com
ServerAlias bungle.example.com
ServerAdmin bongle@example.com
RackEnv bongle_production
RailsEnv bongle_production
DocumentRoot "/Users/Nigel/Rails/bungle/public"
CustomLog "/var/log/apache2/access_log" combinedvhost
ErrorLog "/var/log/apache2/error_log"
<IfModule mod_ssl.c>
SSLEngine Off
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
SSLProtocol -ALL +SSLv3 +TLSv1
SSLProxyEngine On
SSLProxyProtocol -ALL +SSLv3 +TLSv1
</IfModule>
<Directory "/Users/Nigel/Rails/bungle/public">
Options All +MultiViews -ExecCGI -Indexes
AllowOverride None
<IfModule mod_dav.c>
DAV Off
</IfModule>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName burble.anothersite.com
ServerAlias www.anothersite.com
ServerAdmin bongle@anothersite.com
RackEnv burble_production
RailsEnv burble_production
DocumentRoot "/Users/Nigel/Rails/burble/public"
CustomLog "/var/log/apache2/access_log" combinedvhost
ErrorLog "/var/log/apache2/error_log"
<IfModule mod_ssl.c>
SSLEngine Off
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
SSLProtocol -ALL +SSLv3 +TLSv1
SSLProxyEngine On
SSLProxyProtocol -ALL +SSLv3 +TLSv1
</IfModule>
<Directory "/Users/Nigel/Rails/school/public">
Options All +MultiViews -ExecCGI -Indexes
AllowOverride None
<IfModule mod_dav.c>
DAV Off
</IfModule>
</Directory>
</VirtualHost>
Additional contributions to improve this are welcome.
Best Answer
There's no built-in GUI, but there are third party ones. One that I know of for managing virtual hosts is called VirtualHostX: http://clickontyler.com/virtualhostx/