虚拟主机上的错误目录

虚拟主机上的错误目录

我想在我的 VPS 上安装 3 个不同的域名,它们是

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

我已经配置了它们,但由于某种原因,我被重定向到与 lsgob.us 中相同的 index.html

内部网

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>配置块:它们是否存在并且配置了不同的DocumentRoot

相关内容