Mailing List Archive

config - how are multiple VirtualHost directives for the same address handled?
Hi!

How does apache httpd 2.4 handle multiple VirtualHost directives for the same address ?

For example:

<VirtualHost *:443>
SSLCertificateFile "${SRVROOT}/conf/server.crt"
# ...
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "/www/docs/host.example.com"
# ...
</VirtualHost>

Are the settings merged, as if written like this:

<VirtualHost *:443>
SSLCertificateFile "${SRVROOT}/conf/server.crt"
# ...
DocumentRoot "/www/docs/host.example.com"
# ...
</VirtualHost>
?

Or is one directive block used and the other ignored (which one)?

The reason I ask is that I have general SSL related settings in one file ( ssl.conf ) and the content related settings in another ( content.conf ) and both config files are included in the main config file.

Lep pozdrav,
David Balažic

The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.
B?KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB??[??X???X?KK[XZ[?\?\??][??X???X?P ?\X?K???B???Y][?[??[X[??K[XZ[?\?\??Z[ ?\X?K???B
RE: config - how are multiple VirtualHost directives for the same address handled? [ In reply to ]
>
> How does apache httpd 2.4 handle multiple VirtualHost directives for the
> same address ?
>
> For example:
>
> <VirtualHost *:443>
> SSLCertificateFile "${SRVROOT}/conf/server.crt"
> # ...
> </VirtualHost>
>
> <VirtualHost *:443>
> DocumentRoot "/www/docs/host.example.com"
> # ...
> </VirtualHost>
>
> Are the settings merged, as if written like this:
>
> <VirtualHost *:443>
> SSLCertificateFile "${SRVROOT}/conf/server.crt"
> # ...
> DocumentRoot "/www/docs/host.example.com"
> # ...
> </VirtualHost>

But you are using ServerName and ServerAlias to load the correct one not?


>
> Or is one directive block used and the other ignored (which one)?
>
> The reason I ask is that I have general SSL related settings in one file
> ( ssl.conf ) and the content related settings in another ( content.conf
> ) and both config files are included in the main config file.
>

You can have general ssl stuff in different (global) config. There is already such file and just add these to the Virtualhost

SSLEngine on
SSLCertificateFile
SSLCertificateKeyFile
SSLCertificateChainFile


B?KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB??[??X???X?KK[XZ[?\?\??][??X???X?P ?\X?K???B???Y][?[??[X[??K[XZ[?\?\??Z[ ?\X?K???B
RE: config - how are multiple VirtualHost directives for the same address handled? [ In reply to ]
From: Marc <Marc@f1-outsourcing.eu>
Sent: Friday, 30 June 2023 13:00
>
> How does apache httpd 2.4 handle multiple VirtualHost directives for
> the same address ?
>
> For example:
>
> <VirtualHost *:443>
> SSLCertificateFile "${SRVROOT}/conf/server.crt"
> # ...
> </VirtualHost>
>
> <VirtualHost *:443>
> DocumentRoot "/www/docs/host.example.com"
> # ...
> </VirtualHost>
>
> Are the settings merged, as if written like this:
>
> <VirtualHost *:443>
> SSLCertificateFile "${SRVROOT}/conf/server.crt"
> # ...
> DocumentRoot "/www/docs/host.example.com"
> # ...
> </VirtualHost>

But you are using ServerName and ServerAlias to load the correct one not?

There is no correct one. Both are correct. I want both.

Regards,
David

The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: config - how are multiple VirtualHost directives for the same address handled? [ In reply to ]
On Fri, Jun 30, 2023 at 5:49?AM David Balazic
<David.Balazic@endava.com.invalid> wrote:
>
> Hi!
>
> How does apache httpd 2.4 handle multiple VirtualHost directives for the same address ?

There is no virtual host merging. It should be a simple test.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: config - how are multiple VirtualHost directives for the same address handled? [ In reply to ]
> >
> > How does apache httpd 2.4 handle multiple VirtualHost directives for
> > the same address ?
> >
> > For example:
> >
> > <VirtualHost *:443>
> > SSLCertificateFile "${SRVROOT}/conf/server.crt"
> > # ...
> > </VirtualHost>
> >
> > <VirtualHost *:443>
> > DocumentRoot "/www/docs/host.example.com"
> > # ...
> > </VirtualHost>
> >
> > Are the settings merged, as if written like this:
> >
> > <VirtualHost *:443>
> > SSLCertificateFile "${SRVROOT}/conf/server.crt"
> > # ...
> > DocumentRoot "/www/docs/host.example.com"
> > # ...
> > </VirtualHost>
>
> But you are using ServerName and ServerAlias to load the correct one
> not?
>
> There is no correct one. Both are correct. I want both.

I don't understand the problem you are trying to solve.

FWIIW from my past experience having identical virtual host configurations, apache services the one it first/last loads and ignores the rest. You just have to test this, but I would not want to use such a thing in production.




???????????????????????????????????????????????????????????????????????F?V?7V'67&?&R?R???âW6W'2?V?7V'67&?&T?GGB?6?R??&p?f?"FF?F????6????G2?R???âW6W'2?V??GGB?6?R??&p