0

I have a few virtual machines with apache 2.4 installed, and the base setup made by the hosting provider. They specify the IP address in every virtual host configuration:

<VirtualHost 123.234.56.89:80>
ServerName ...
</VirtualHost>

For the web application I develop, I have virtual host configurations which are managed by an SCM system and symlinked into the Apache configuration. It would be very useful if I could use the same configuration on both my development machine and the production servers, and rather have:

<VirtualHost *:80>
ServerName ...
ServerAlias development.host.local
...
</VirtualHost>

However, it doesn't really work to mix virtual hosts with fixed and wildcard (*) IP specifications.

So, my question is: Is there a performance reason to nail virtual hosts to fixed IP specifications?

Is this needed for SSL setups (which applies to some but not all of my sites)?

I use Debian and CentOS Linux, and Apache 2.2 and 2.4; my servers have 1 to 4 IP4 addresses.

1

So, my question is: Is there a performance reason to nail virtual hosts to fixed IP specifications?

The only performance related reasons for using name based vs ip based is if you've got a limited pool. Name based virtual hosting will not occupy precious IP addresses. The server will be parsing/processing the http headers whether or not you use name based hosting. It's also easier to manage named DNS records than it is config files full of IPs. These things considered, in certain situations IP based virtual hosting could be weaker.

Is this needed for SSL setups (which applies to some but not all of my sites)?

I can't think of a reason you'd only set up SSL on a fixed IP. The cert will be for a specific domain - name based virtual hosting would be easiest way to configure/manage it.

  • My virtual hosting includes ServerNames in any case; even when there are IPs written in the spec, there can be more than one virtual hosts (which made me wonder about the necessity), so it is "name based" nevertheless. So there is no compelling reason not to use *:80, right? – Tobias Jun 10 '16 at 12:01
  • That's right. Unless you want to segregate traffic by the IP interface you receive it on, there's no reason to IP filter. Then obviously SSL comes in on :443 – L Martin Jun 10 '16 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.