Running Snow Leopard, I have enabled the build in apache(with indexing) and php, and installed and enabled mysql. I have setup my sites in the ~/Sites
directory, named:
- www.site1.dev
- www.site2.dev
It all works,localhost
shows the index linking to them.
Now I want to set up virtual hosts in the most simple way. I would like that typing www.site1.dev
in the url bar serves me the site in that directory.
So I outcommented the include vhosts rule in the httpd.conf
file, and in the httpd-vhosts.conf
pasted this code based on the apache docs:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /Users/me/Sites
UseCanonicalName off
VirtualDocumentRoot /Users/me/Sites/%0
AllowOverride All
RewriteEngine On
</VirtualHost>
Yet my browser can't find the server. What am I doing wrong? I did notice that in my sharing system prefs the IP my ISP gives me, and their domain is included in the link created there to access my sites folder. I would expect a simple localhost there not an ipaddress....
/etc/hosts
. – Michal M Jun 07 '11 at 15:44hosts
config. This is because it uses BIND DNS. If you do this though, you won't be able to use full domains as you want (http:// www.site1.dev). You'd have to use "local" domains (http:// site1.local). – Michal M Jun 07 '11 at 15:51site1
andsite2
without activating virtualhosts, I can just access them like that. But then they are all on the same server. Which creates problems for serversite scripting. When activate virtualhosts and create the virtualdocumentroot – newnomad Jun 07 '11 at 20:59site1
andsite2
, you're still able to use all the things server-side scripting gives you, this includes .htaccess config. It's all matter of having correct paths, that's it. – Michal M Jun 07 '11 at 21:55