Answer the question
In order to leave comments, you need to log in
How to make Apache NOT confuse virtualhosts?
I'm trying to get some sites to work with SSL, and some not.
Faced a problem: Apache confuses the certificate files of the first and second site.
It is CERTIFICATES, not DocumentRoot.
Не удалось подтвердить, что это сервер site2.site. Его сертификат безопасности относится к site1.site. Возможно, сервер настроен неправильно или кто-то пытается перехватить ваши данные.
<VirtualHost site2.site>
DocumentRoot /var/www/mrcheatga/site2.site
<Directory "/var/www/mrcheatga/site2.site">
allow from all
Options None
Require all granted
</Directory>
SSLEngine on
SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
SSLCertificateFile /etc/letsencrypt/live/site2.site/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site2.site/privkey.pem
</VirtualHost>
<VirtualHost site1.site>
DocumentRoot /var/www/site1.site
<Directory "/var/www/site1.site">
allow from all
Options None
Require all granted
</Directory>
SSLEngine on
SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
SSLCertificateFile /etc/letsencrypt/live/site1.site/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site1.site/privkey.pem
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
you
<VirtualHost site2.site>
should have in your config something like
<VirtualHost *:80>
DocumentRoot /var/www/mrcheatga/site2.site
<Directory "/var/www/mrcheatga/site2.site">
allow from all
Options None
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =site2.site
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/mrcheatga/site2.site
<Directory "/var/www/mrcheatga/site2.site">
allow from all
Options None
Require all granted
</Directory>
SSLEngine on
SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
SSLCertificateFile /etc/letsencrypt/live/site2.site/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site2.site/privkey.pem
</VirtualHost>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question