私は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
。