虛擬主機上的目錄錯誤

虛擬主機上的目錄錯誤

我試圖在我的 VPS 上擁有 3 個不同的網域,它們是

pd.lsgob.us
intranet.lsgob.us 
lsgob.us

我已經配置了它們,但由於某種原因,我被重定向到與 lsgob.us 中的相同的 index.html

內網lsgob.us

https://i.stack.imgur.com/0Wwxz.png

lsgob.us

https://i.stack.imgur.com/9KHFW.png

虛擬主機內部網路

<VirtualHost *:80>

    ServerAdmin [email protected]
    ServerName intranet.lsgob.us
    ServerAlias www.intranet.lsgob.us
    DocumentRoot "/var/www/intranet/"

    <Directory "/var/www/intranet/">

            Options Indexes FollowSymLinks
            AllowOverride all
            Require all granted

    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.intranet.lsgob.us [OR]
    RewriteCond %{SERVER_NAME} =intranet.lsgob.us
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

虛擬主機 lsgob

<VirtualHost *:80>

    ServerAdmin [email protected]
    ServerName lsgob.us
    ServerAlias www.lsgob.us
    DocumentRoot /var/www/lsgob

    <Directory /var/www/lsgob>

            Options Indexes FollowSymLinks
            AllowOverride all
            Require all granted

    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.lsgob.us [OR]
    RewriteCond %{SERVER_NAME} =lsgob.us
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

答案1

這兩個虛擬主機都會重新導向到 HTTPS:

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

因此,他們的內容是什麼並不重要DocumentRoot。相反,您應該檢查相應的<VirtualHost *:443>配置塊:它們是否存在並且配置有不同的DocumentRoots。

相關內容