R
The thing is, when you connect through SSL. First a secure connection to the certificate, and only Then... The request is transmitted, including the headline of the Host, indicating which site is being treated. So if you have several websites on one IP address and a port, they'll all be open on the IP/port certificate.You must clearly indicate which virtual host is responsible for port 443 (SSL), his name should be the same as that indicated in the certificate. And for the other virtual hosts, it's clear that they should only listen to port 80.In addition, it is important to take into account the nuance that if Apache received a request for an IP/port with a title Host: XXXand he couldn't find a virtual host with him. ServerName XXX or ServerAlias XXX, he'll forward the processing request to First virtual host suitable for IP/port♪ So if you want to get a hold of this IP/host's request not a site, but some plug, you need to configure. VirtualHost with this silence and put it before all the others. VirtualHost IP/port.Summary:Don't do that.Don't point out virtual hosts without port instructions.<VirtualHost *>
# ^^^ нет порта!
# это приведет к ошибкам/неожиданному поведению
</VirtualHost>
Give me a port for virtual hosts.<VirtualHost *:80>
# сайт без SSL
...
</VirtualHost>
<VirtualHost *:443>
# сайт с SSL
...
</VirtualHost>
If several SSL certificates are used for different sites, they need to be divided into different IPs, for example:<VirtualHost 127.0.0.1:443>
ServerName ssl-site1.com
...
</VirtualHost>
<VirtualHost 127.0.0.2:443>
ServerName ssl-site2.com
...
</VirtualHost>
Or different ports (443, 1443, 2443, etc.), but it's not very convenient.Create a key for a non-existent siteIf you don't want the first content to be given at the request of a non-existent site VirtualHostIP/port, do the IP/port and place it. before Other virtual hosts:<VirtualHost *:443>
# заглушка для SSL
ServerName host-does-not-exist-stub.tech
DocumentRoot /var/www/stub/public_html
...
</VirtualHost>
<VirtualHost *:443>
# сайт с SSL
ServerName real-ssl-site.ru
DocumentRoot /var/www/real-ssl-site.ru/public_html
...
</VirtualHost>