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

[patch] IP-based virtual server support, 2.4.9-ac5-C0

based on suggestions on this list i reworked TUX's virtual server support,
which is available in the newest TUX patch:


there are two main areas of changes: the introduction of IP based virtual
serving, and the handling of 'default' virtual docroots.

TUX now supports four different virtual serving modes:

 - standalone

 - host based

 - IP based

 - mixed IP and host based.

standalone and host based was present already. IP based virtual serving
can be enabled by:

        echo 2 > /proc/sys/net/tux/virtual_server

in this case the local address of the connection is used as a directory
name in docroot. Eg. if the absolute docroot is /var/www/html/, and the IP
address of eth0 is, the IP address of eth1 is, then all
requests coming from eth0 will be served from the /var/www/html/
directory, and all requests from eth1 are served from the
/var/www/html/ directory. The actual Host: fields in the requests
are ignored. An unlimited number of interfaces and IP addresses can be

in the case of 'mixed' virtual serving:

        echo 2 > /proc/sys/net/tux/virtual_server

both the IP address and the Host: field (if existent) are used to
determine the virtual docroot - eg. in the above example, if a request
comes from eth0, and the browser sends "Host: www.site.com", then the
virtual docroot is /var/www/html/ While i dont
expect this to be a commonly used mode, it is rather straightforward and
can be used to isolate eg. internal and external traffic based on
interfaces (eg. the external interface is the current production version
of a document hierarchy, the internal interface is used to serve the new,
test version of the site(s)), and then still have lots of separate virtual
hosts based on the Host: field.

the other change is the introduction of a default vhost that is used if a
nonexistent Host: field is sent by the browser.
/proc/sys/net/tux/default_vhost can be used (with an initial "default"
value) to eg. redirect all unknown hosts to another directory. Eg., if
Host: www.badsite.com is sent by the browser, and $docroot/www.badsite.com
does not exist, then the $docroot/default/ directory is used instead. This
is purely a convenience.

comments, suggestions welcome.


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