What is the maximum number of VirtualHosts a single lighttpd instance can handle?
When you're configuration is smart, lighttpd does not impose any upper limit.
You can use mod_simple_vhost
and have unlimited VirtualHosts. Adding or Removing VirtualHosts won't require any change in the lighttpd configuration, nor a reload. Simply create a directory and your new VirtualHost becomes active. Delete the directory and the VirtualHost is disabled.
In practice of course there will be limits:
in addition to load and traffic that probably depends partly on how you configure each virtual host as well when you're not using mod_simple_vhost
. Are you using TLS/SSL certificates, serving only static content or dynamically generated content?
For example, as in the Apache question you linked already mentions (somewhat casually), when you don't use mod_simple_vhost and explicitly configure each VirtualHost and configure them with their own separate error and access log files, you pay quite a performance penalty. For each additional log file a web server needs to maintain additional open file handles and you risk running out of file descriptors much more rapidly, compared to maintaining a single log file (with a format that adds a label/field to identify a particular virtual host).