I'm using Yosemite with Apache 2.4
/private/etc/apache2/httpd.conf
ServerName 127.0.0.1:80
DocumentRoot "/Library/WebServer/Documents/"
<Directory "/Library/WebServer/Documents">
Options Multiviews FollowSymLinks
MultiviewsMatch Any
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Everything is fine, http://localhost directs me to the default /Library/WebServer/Documents/index.html
After adding Include /private/etc/apache2/extra/httpd-vhosts.conf to /private/etc/apache2/httpd.conf
And adding the config below to /private/etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName xxx.local
DocumentRoot "/Library/WebServer/Documents/xxx"
<Directory "/Library/WebServer/Documents/xxx/">
Options +FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
When using http://localhost and http://127.0.0.1 from the browser, Apache directs me to /Library/WebServer/Documents/xxx/index.html instead of /Library/WebServer/Documents/index.html, how can I fix it?, please guide.
Thanks.
DocumentRootto/Library/WebServer/Documentsif that's what you want?DocumentRoot "/Library/WebServer/Documents/"it's already there in the file httpd.conf, but I still have this problemDocumentRootis/Library/WebServer/Documents/xxxinstead of/Library/WebServer/Documents/so obviously the problem remains.DocumentRoothas been there but I just forgot to mention in the post,http://localhostdirects to the path specified inVirtualHost'sDocumentRoothttpd-vhosts.conffile if that's not where you want theDocumentRootto be? Once you define a VirtualHost it will take precedence over default settings.