I am attempting to setup Apache virtual hosts on Mac OSX 10.7.4
I have this in my /etc/apache/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Users/jason/Sites/testsite/site"
ServerName dev.testsite.com
ServerAlias dev.testsite.com
</VirtualHost>
This is in /etc/hosts
127.0.0.1 dev.testsite.com
Located in /Users/jason/Sites/testsite/site/ this is an index.html file that contains "This is my test site".
When I go to dev.testsite.com in my browser, I expect to the the page at /Users/jason/Sites/testsite/site/, but instead I am seeing a page at the "Computer's website folder" at /Library/WebServer/Documents/
I can't work out how or why this would be and any suggestions or pointers would be greatly appreciated.
Many THanks in advance.
Jason
* *UPDATE
I've found that if I replace the DocumentRoot settings in /etc/apache/httpd.conf with the path that I want traffic to go to, it does go there, so it looks like the DocumentRoot setting in httpd-vhosts.conf is not replacing the DocumentRoot setting in httpd.conf. I'm comparing my httpd-vhosts.config settings with those of another mac I have been successfully runing virtual hosts on for a couple of years and they look the same from what I can see, so I'm guessing there is some setting I need to turn on or off(?)
Thanks again for any pointers!
Found it.
The httpd-vhosts.conf hadn't been included in httpd.conf
I needed to uncomment the following line in /etc/apache/httpd.conf
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Once I did this, all worked fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.