我不知道這裏發生了什麼,但我在Mac OS X上運行甲基苯丙胺1.9在我的httpd.conf文件,DocumentRoot的設置爲默認的htdocs目錄路徑。在htdocs文件夾中,我創建了一些「子網站」,以便將它們設置爲虛擬主機....我可以訪問指定的路徑,但它們似乎都默認爲我設置的第一個路徑。MAC OS X:MAMP環境與虛擬主機
實質上,我配置的第一個虛擬主機是爲site1.localhost.com。我自從配置了site2.localhost.com和site3.localhost.com。但是,轉到最後兩個地址中的任何一個,總是會將我重定向到site1.localhost.com。此外,去localhost.com:8888也只是拉起site1.localhost.com。我不知道我在哪裏犯了一個錯誤的步驟,但希望這裏的某個人能夠幫助我找出問題......哦,並且在重新啓動apache等之後,對/ etc /主機或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
啊啊啊謝謝!它讓我瘋狂! – locrizak 2011-06-18 19:56:48