Answer the question
In order to leave comments, you need to log in
How to set up multiple Name-Based Sites in Apache on Mac?
Good evening. I'm new to mac and setting up servers, so I need help from knowledgeable people (sorry if the question seems stupid and your answer is obvious).
I'm setting up Apache for PHP on Mac OS X Mavericks according to the manual , I can't set up several name-based sites.
Contents of /etc/apache2/extra/httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /Users/tortik/Sites/firstsite.dev
ServerName firstsite.dev
ServerAlias firstsite.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Users/tortik/Sites/secondsite.dev
ServerName secondsite.dev
ServerAlias secondsite.dev
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
It is written in your config that the first host should be given by the domain name firstsite.dev , and the second by secondsite.dev . Nothing is said about the localhost domain name , which means that it will return the host that is considered default by apache .
Write these domain names in your hosts file :
so that they resolve to your local loop where apache listens.
And try to already access sites by these domain names.
Also try using apachectl -S(if the Mac has one) to see which virtual hosts apache sees and which one is set as default.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question