Re: [users@httpd] How can I configure “apache2” correctly using multiple sites through VirtualHost?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 20, 2021 at 6:25 AM Marcel Roșca <roscamarcel88@xxxxxxxxx> wrote:
>
> I configured two sites using the "VirtualHost" method in apache2, but if there is an error in the first configuration file when I call my site, it enters the second site.
...
> the problem is when an error occurs in one of these two files, when I access for example audio-castle.live, I reach the site gtdvm.com, if the error is in the audio-castle.live file. my question is: how to avoid this redirect from one site to another when one of them encounters errors? . I use Ubuntu 20.04, apache2.4.46.

This is expected behavior.  When you use name-based virtual hosts, the
first host processed becomes the "default", and will respond to
requests for Hosts that do not match any other definition.  One way to
address this might be to create a simple virtual host in the main
configuration, or that is included before any other virtual hosts,
that returns an error page

<VirtualHost *:80>
    Redirect 404 /
    ErrorDocument 404 "Page Not Found"
</VirtualHost>

Doing this should cause all requests that do not match a ServerName
directive to 404 instead of going to some other host.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux