我希望我的两个站点:flowers.loc(Drupal 8)和honey.loc(Drupal 7)站点在Apache本地工作(v:2.234)。
flowers.loc的第一个目录:
Sites/drupal8/docroot
honey.loc的第二个目录:
Sites/drupal7/docroot
我在httpd,apache配置文件中有这个设置:
<VirtualHost *:80>
DirectoryIndex index.html index.php
DocumentRoot /User/Vizzaro/Sites
<Directory "/User/Vizzaro/Sites">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
答案 0 :(得分:1)
查看https://httpd.apache.org/docs/2.2/vhosts/examples.html以了解如何设置虚拟主机。您的配置文件只有一个虚拟主机条目,但每个站点需要一个条目。此外,您的配置缺少ServerName。试试这个:(未经测试)
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName flowers.loc
DocumentRoot /User/Vizzaro/Sites/drupal8/docroot
# Other directives here
</VirtualHost>
<VirtualHost *:80>
ServerName honey.loc
DocumentRoot /User/Vizzaro/Sites/drupal7/docroot
# Other directives here
</VirtualHost>
并且确保honey.loc和flowers.loc都指向你的apache正在运行的机器的IP。试试ping flowers.loc
- 如果这导致Name or service not known
之类的错误,您可能需要编辑您的主机文件来修复它。