MAC OS X: среда MAMP и виртуальные хосты

Я не уверен, что здесь происходит, но я использую MAMP 1.9 в MAC OS X. В моем файле httpd.conf для DocumentRoot задан путь по умолчанию для htdocs. В папке htdocs я создал несколько «дочерних сайтов», пытаясь настроить их как виртуальные хосты .... Я могу добраться до указанных путей, но все они, по-видимому, по умолчанию соответствуют первому, который я настроил ,

По сути, первый VirtualHost, который я настроил, был для site1.localhost.com. С тех пор я настроил site2.localhost.com и site3.localhost.com. Тем не менее, переход на любой из последних двух адресов, кажется, всегда перенаправляет меня на site1.localhost.com. Кроме того, посещение только localhost.com:8888 также просто подтягивает site1.localhost.com. Я не уверен, где я сделал неправильный шаг, но, надеюсь, кто-то здесь сможет помочь мне разобраться в проблеме ... О, и я перезапустил apache и т. Д., После любых изменений, внесенных в / etc / файл hosts или httpd.conf.

В моем файле httpd.conf (соответствующие части, в любом случае ...):

#                                                                                                                                                                                                                                                                             
# DocumentRoot: The directory out of which you will serve your                                                                                                                                                                                                                
# documents. By default, all requests are taken from this directory, but                                                                                                                                                                                                      
# symbolic links and aliases may be used to point to other locations.                                                                                                                                                                                                         
#                                                                                                                                                                                                                                                                             
# MAMP DOCUMENT_ROOT !! Don't remove this line !!                                                                                                                                                                                                                             


 DocumentRoot "/Applications/MAMP/htdocs"

#                                                                                                                                                                                                                                                                             
# Note that from this point forward you must specifically allow                                                                                                                                                                                                               
# particular features to be enabled - so if something's not working as                                                                                                                                                                                                        
# you might expect, make sure that you have specifically enabled it                                                                                                                                                                                                           
# below.                                                                                                                                                                                                                                                                      
#                                                                                                                                                                                                                                                                             

#                                                                                                                                                                                                                                                                             
# This should be changed to whatever you set DocumentRoot to.                                                                                                                                                                                                                 
#                                                                                                                                                                                                                                                                             
<Directory "/Applications/MAMP/htdocs">

<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/site1/"
ServerName site1.localhost.com
</VirtualHost>

<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/sub/site2/"
ServerName site2.localhost.com
</VirtualHost>

<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/sub/site3/"
ServerName site3.localhost.com
</VirtualHost>

В моем файле / etc / hosts:

##                                                                                                                                                                                                                                                                            
# Host Database                                                                                                                                                                                                                                                               
#                                                                                                                                                                                                                                                                             
# localhost is used to configure the loopback interface                                                                                                                                                                                                                       
# when the system is booting.  Do not change this entry.                                                                                                                                                                                                                      
##                                                                                                                                                                                                                                                                            
127.0.0.1       localhost
127.0.0.1       site1.localhost.com
127.0.0.1       site2.localhost.com
127.0.0.1       site3.localhost.com
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

Ответы на вопрос(3)

Ваш ответ на вопрос