Kar*_*rma 6 macos mamp virtualhost
我不确定这里发生了什么,但我在MAC OS X上运行MAMP 1.9.在我的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>
Run Code Online (Sandbox Code Playgroud)
在我的/ 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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5150 次 |
最近记录: |