Serving multiple root directories in Apache
我希望我的两个站点:flowers.loc(Drupal 8)和honey.loc(Drupal 7)网站可以在Apache上本地工作(v:2.234)。
flowers.loc的第一个目录:
1 | Sites/drupal8/docroot |
honey.loc的第二个目录:
1 | Sites/drupal7/docroot |
我在httpd,apache配置文件中具有此设置:
1 2 3 4 5 6 7 8 9 10 11 | <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> |
查看https://httpd.apache.org/docs/2.2/vhosts/examples.html,了解如何设置虚拟主机。您的配置文件只有一个虚拟主机条目,但是每个站点都需要一个条目。而且,您的配置缺少ServerName。试试这个:(未经测试)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 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。尝试