Mac Os X.虚拟主机

时间:2014-09-01 07:31:32

标签: macos apache virtualhost

我想使用apache 2.2.6在我的Mac OS 10.9.4上安装几个虚拟主机。我已经有一个虚拟主机,它工作正常,但是当我添加第二个主机时,它会将我重定向到第一个。

/etc/apache2/users/alex.conf

<Directory "/Users/alex/Sites/">
    Options FollowSymLinks Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
   ServerAdmin webmaster@example
   DocumentRoot "/Users/alex/Sites/site1.loc"
   ServerName site1.loc
   ServerAlias site1.loc
   <Directory "/Users/alex/Sites/site1.loc">
       AllowOverride All
       Allow from all
   </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin webmaster@example
   DocumentRoot "/Users/alex/Sites/site2.loc"
   ServerName site2.loc
   ServerAlias site2.loc
   <Directory "/Users/alex/Sites/site2.loc">
       AllowOverride All
       Allow from all
   </Directory>
</VirtualHost>

的/ etc / hotst

##
# 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
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost
127.0.0.1 site1.loc
127.0.0.1 site2.loc

SITE1.loc工作正常,但是当我转到site2.loc时,它会重定向到site1.loc。我怎样才能解决这个问题? 谢谢。对不起我的英文

0 个答案:

没有答案