Apache 顯示一般根索引,而不是在 Debian 中使用虛擬主機配置的 DocumentRoot 索引

Apache 顯示一般根索引,而不是在 Debian 中使用虛擬主機配置的 DocumentRoot 索引

我有多個網站,每個網站都有自己的網域(例如site1.com,等)。每個網站的操作目錄都是專用子資料夾differentsite2.comothersite3.com/var/www/html/

例如

/var/www/html/site1
/var/www/html/site2
/var/www/html/site3

每個網站的虛擬主機都是這樣的

<VirtualHost *:80>
    ServerName site1.com
    ServerAlias www.site1.com
    DocumentRoot /var/www/html/site1
    <Directory /var/www/html/site1>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
</VirtualHost>

/etc/apache2/sites-available/ 使用命令啟用專用配置文件a2ensite,使用命令禁用預設配置a2dissite 000-default.conf

其他網站的配置方式類似

<VirtualHost *:80>
    ServerName site2.com
    ServerAlias www.site2.com
    DocumentRoot /var/www/html/site2
</VirtualHost>

ETC。

問題:

當我打開而不是按預期www.site1.com顯示索引時,它顯示主根中的索引DocumentRoot/var/www/html/site1/index/var/www/html/index

有人可以幫助他理解這個問題嗎?

答案1

該問題是由於 Apache 伺服器配置在連接埠 8080 上,Nginx 配置在連接埠 80 上,因此當我在連接埠 80 上呼叫網站時,呼叫由 Nginx 處理。

相關內容