MAMP 通过修改vhost文件配置虚拟主机,为什么只能一个生效?

我在MAMP(非专业版)对应的apache 的httpd-vhost文件中配置了多个虚拟机,但只能有一个生效.

### 相关代码

<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs/crm.com"
    ServerName crm.com
    <Directory "/Applications/MAMP/htdocs/crm.com">
       Options +Indexes +Includes +FollowSymLinks +MultiViews
       AllowOverride All
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs/lr.com/public"
    ServerName lr.com
    <Directory "/Applications/MAMP/htdocs/lr.com/public">
       Options +Indexes +Includes +FollowSymLinks +MultiViews
       AllowOverride All
    </Directory>
</VirtualHost>               
阅读 2.5k
1 个回答

如果要区分,需要区分端口,或指定域名:

<VirtualHost www.abc.com:80>
...
<VirtualHost web.abc.com:80>
或
<VirtualHost www.abc.com:80>
...
<VirtualHost www.abc.com:8080>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏