Falsches Verzeichnis auf dem virtuellen Host

Falsches Verzeichnis auf dem virtuellen Host

Ich versuche, 3 verschiedene Domänen auf meinem VPS zu haben, das sind

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

Ich habe sie konfiguriert, aber aus irgendeinem Grund werde ich auf dieselbe index.html umgeleitet wie auf lsgob.us

intranet.lsgob.us

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

lsgob.us

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

Virtualhost-Intranet

<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

Virtueller Host 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

Antwort1

Beide dieser virtuellen Hosts führen eine Weiterleitung zu HTTPS durch:

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

Daher ist es egal, was in ihren steht DocumentRoot. Stattdessen sollten Sie die entsprechenden <VirtualHost *:443>Konfigurationsblöcke überprüfen: dass sie existieren und mit unterschiedlichen DocumentRoots konfiguriert sind.

verwandte Informationen