不同端口上的Apache Virtualhost重定向到DefaultRoot

不同端口上的Apache Virtualhost重定向到DefaultRoot,apache,Apache,我正在尝试使用Apache2.4将虚拟主机设置为侦听不同端口 在端口80上:一个普通的HTML页面。 在端口81上:Angular6应用程序 在我的0_web.conf上 <VirtualHost *:80> ServerName web DocumentRoot /var/www/html/web DirectoryIndex index.html <Directory /var/www/html/web> All

我正在尝试使用Apache2.4将虚拟主机设置为侦听不同端口

在端口80上:一个普通的HTML页面。 在端口81上:Angular6应用程序

在我的0_web.conf上

<VirtualHost *:80>
    ServerName web
    DocumentRoot /var/www/html/web
        DirectoryIndex index.html

    <Directory /var/www/html/web>
       AllowOverride all
    </Directory>
</VirtualHost>
当我输入时,我进入html页面,但是accesing使我进入“Index of/”,列出了web/


有什么想法吗?我在这里遇到了麻烦。

我没有看到第二个vHost中定义的DocumentRoot。也许加上

DocumentRoot /var/www/dist/

conf

当vhost与特定url不匹配时,apache使用第一个vhost。端口81的vhost具有servername munitdp,因此url与之不匹配,因此使用了第一个vhost。能否尝试从第二个vhost中删除servername指令?完成。还是一样的结果,就是这样。没有注意到这一点,我感到很傻。谢谢
Listen 81
<VirtualHost *:81>
    ServerName munitdp
    <Directory /var/www/dist/>
        RewriteEngine on

        # Don't rewrite files or directories
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^ - [L]

        # Rewrite everything else to index.html
        # to allow html5 state links
        RewriteRule ^ index.html [L]
    </Directory>
</VirtualHost>
DocumentRoot /var/www/dist/