Apache2 Ubuntu中有多个虚拟主机

Apache2 Ubuntu中有多个虚拟主机,apache,Apache,我尝试在apache中配置一个新的虚拟主机。我已经复制了默认值。更新了路径。conf看起来像这样 <VirtualHost *:8081> ServerAdmin webmaster@localhost DocumentRoot /home/ubuntu/video <Directory /> Options FollowSymLinks AllowO

我尝试在apache中配置一个新的虚拟主机。我已经复制了默认值。更新了路径。conf看起来像这样

    <VirtualHost *:8081>
        ServerAdmin webmaster@localhost

        DocumentRoot /home/ubuntu/video
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /home/ubuntu/video>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
               Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
         </Directory>

        ErrorLog /home/ubuntu/video/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /home/ubuntu/video/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
这使该虚拟主机成功添加并将在重新加载时运行。但我无法访问相同的。我已经检查了路径
/home/ubuntu/video
,其中还创建了error.log、access.log文件。我既找不到问题,也找不到解决办法。如果有人有同样的问题,我会在网上搜索

以下博文:,在其更新中说,我们不能创建多个虚拟主机。我已经安装了虚拟主机。这是否意味着第二个虚拟主机无法在Ubuntu for apache中配置?

Read

如果您尝试在没有
名称virtualhost name:port
的情况下使用
,或者尝试使用
Listen
指令,您的配置将无法工作

因此,请确保这些指令位于
标记之外:

Listen 8081
NameVirtualHost *:8081
您还可以添加:

ServerName www.example.com

到您的
VirtualHost
节。

在/etc/apache2/sites enabled/video的第4行出现语法错误:无法在节中侦听操作“configtest”失败。Apache错误日志可能包含更多信息。。。失败!抱歉-
Listen
NameVirtualHost
应该放在任何
VirtualHost
ServerName www.example.com