VirtualHosts不工作?

时间:2013-04-17 21:29:57

标签: apache mamp virtualhost httpd.conf

我似乎无法让我的虚拟主机工作......想想我对我正在做的事情一无所知。

的httpd.conf

NameVirtualHost *

<VirtualHost *>
    ServerName localhost
    DocumentRoot "/Applications/MAMP/bin/mamp"
    <Directory "/Applications/MAMP/bin/mamp">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride None
        Order Allow,Deny
        Allow From All
    </Directory>
</VirtualHost>

# rev.dev
<VirtualHost *>
    ServerName revcms.dev
    DocumentRoot "/Users/manuel/Sites/Rev"
    <Directory "/Users/manuel/Sites/Rev">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride None
        Order Allow,Deny
        Allow From All
    </Directory>
</VirtualHost>

等/主机

##
# Host Database 
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##


255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

127.0.0.1 rev.dev

我完全不知道我做错了什么,http://rev.dev的行为与127.0.0.1相同 有什么帮助吗?

2 个答案:

答案 0 :(得分:0)

从命令行运行httpd -S(注意大写S)并从那里进行调试。

对于初学者,您的/etc/hosts文件表示服务器名称为rev.dev,但您的虚拟主机说服务器为revcms.dev

将您的虚拟主机文件更改为rev.dev并重新启动apache。

答案 1 :(得分:0)

想出来。我注意到我的命令@ Terminal没有工作,所以删除.bashrc,.bash_profile等,它工作。

谢谢! @Ryan