
サーバー上に 2 つのサイトが稼働していました ( nextcloud.example.com
(Nextcloud インスタンス) とexample.com
(Grav インスタンス))。サーバーに Postfix 構成を追加したところ、メールを送信できるようになりました。ただし、証明書に問題があったため、やり直しました...
の主な問題今は、開こうとすると常にexample.com
が呼び出されexample.com/index.php/login
、 からのログイン ページがレンダリングされますnextcloud.example.com
が、Grav のメイン ページを期待しています。 また、 を呼び出すとexample.com/admin
に解決されますexample.com/index.php/login
。
私はこのトピックについてはまだあまり詳しくないので、これが関連するデータになることを期待しています:
$ apachectl configtest
Syntax OK
私はここに設定ファイルを挿入しましたが、StackExchangeは私のテキストエリアをスパムとしてマークしました。そのため、それらを削除しました。喜んでさらに情報を提供しますが、許可されませんでした...
編集:
apache2ctl -S
VirtualHost configuration:
127.0.1.1:443 example.com (/etc/apache2/sites-enabled/example.com-le-ssl.conf:2)
127.0.1.1:80 example.com (/etc/apache2/sites-enabled/example.com.conf:1)
5.252.225.176:443 nextcloud.example.com (/etc/apache2/sites-enabled/nextcloud.example.com-le-ssl.conf:2)
5.252.225.176:80 nextcloud.example.com (/etc/apache2/sites-enabled/nextcloud.example.com.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
<VirtualHost nextcloud.example.com:443>
DocumentRoot /var/www/nextcloud.example.com/htdocs/
ServerName nextcloud.example.com
<Directory /var/www/nextcloud.example.com/htdocs/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
RewriteEngine off
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
#RewriteCond %{SERVER_NAME} =nextcloud.example.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost example.com:443>
DocumentRoot /var/www/example.com/htdocs/
ServerName example.com
<Directory /var/www/example.com/htdocs/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
#RewriteCond %{SERVER_NAME} =example.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
答え1
おそらくVirtualHostディレクティブのホスト名を に変更する必要があるでしょう*
。つまり、
<VirtualHost nextcloud.example.com:443>
ServerName nextcloud.example.com
...
</VirtualHost>
<Virtualhost example.com:443>
ServerName example.com
...
</VirtualHost>
試す
<VirtualHost *:443>
ServerName nextcloud.example.com
...
</VirtualHost>
<Virtualhost *:443>
ServerName example.com
...
</VirtualHost>
通常、VirtualHost の引数は IP アドレスであるか、*
すべての IP アドレスと一致する必要があります。
上記の最初の形式は、Apache が接続を受信する IP アドレスが example.com の DNS アドレスと異なる場合 (たとえば、example.com がプロキシの背後にある場合) に失敗します。その場合、Apache はデフォルトの仮想ホスト (最初のホスト) からの提供にフォールバックします。この場合は nextcloud.example.com になります。
見る仮想ホスト、 そして名前ベースの仮想ホスト。