Apache2:如何避免一个网站默认回复?

Apache2: how to avoid that one website reply as default?

我有一台带有几个网站的 apache2 服务器。

其中之一同时在 http 和 https 上提供 所有其他服务器仅在 http

I inherited this bad situation from an ex worker of company whre I am imployed, do not blame me

如果我尝试通过 https 访问其他网站,我认为 apach2 是第一个(也是唯一一个)可通过 https 访问的服务器,即使它具有不同的域。

如果我访问https://blablbalca.com, apache2 knows that blablbalca.com is not served on https, but It doesn't give me a 404, it serves https://anotherwebsite.com

什么指令告诉 apache 在错过定义的情况下自动服务 'the first one'?

如何修复?

编辑:我找到了一种更优雅和通用的方式来表达我的问题:

How can I avoid that apache2 serves a random virtual host if a domain, pointing to the same ip, is not really served from my server?

你可以做一个名字最好的虚拟主机并设置ServerNameServerAlias来匹配每个网站。此外,如果您希望 'blablbalca.com' 到 return 在通过 HTTP 访问时出现错误,您必须在 your_site.conf 中设置一个虚拟主机来处理来自 https 端口的流量。比如进行重定向或显示错误页面。

The default configuration file that deals with the incoming connection from a domain name that is not on the server or without domain name at all (direct IP connection):

For port 80:

<VirtualHost *:80>

        ProxyPass "/" "http://your/path/here"
        ProxyPassReverse "/" "http://your/path/here"

</VirtualHost>

For port 443 (SSL):

<VirtualHost *:443>

        ProxyPass "/" "http://your/path/here"
        ProxyPassReverse "/" "http://your/path/here"

</VirtualHost>

The website with a domain:

<VirtualHost *:80>

        ServerName yoursite.com
        ServerAlias www.yoursite.com
        ServerAdmin none@webhost.com
        DocumentRoot /var/www/yourWebsite

</VirtualHost>

我正在删除很多指令,只保留我们在这种情况下关注的指令。