You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Robinson <dr...@ast.cam.ac.uk> on 1996/02/09 20:26:00 UTC

Bind patch

I've uploaded 99.bind.patch which allows Apache to listen on multiple ports.

  Subject: Allow Apache to bind to multiple ports
  Affects: httpd.h, http_conf_globals.h, http_config.c, htp_core.c, http_main.c
  ChangeLog: Add Listen directive, causing Apache to bind to the address and
             port specified. Change virtual hosts to not inherit their port
             setting from the main server, allow port of 0 to match all ports,
             and allow <VirtualHost *>
  Comments: Probably conflicts with the NeXT setsockopt patch.

If Apache sees the Listen directive, then it ignores Port/Bindaddress.

Syntax:
   Listen <address>:<port>

<address> = "*" or network address or DNS domain name.

For convenience, I've fixed
   Listen <port>
to be the same as
   Listen *:<port>

Apache listens on all the ports specified; when a request is accepted, it
it matched against all the VirtualHost sections, with the following
enhancements:

<VirtualHost *>

matches all hostnames for the machine; useful because
Port <port-number>

inside a virtual host section now restricts that hosts to accesses on
the specified port.

(The syntax <VirtualHost address:port> might be preferable, but I didn't have
time to implement it before the submission deadline.)

Example:

Listen 80
Listen 8000

#Enable proxy requests on port 8000
<VirtualHost *>
Port 8000
ProxyRequests on  # this should work, but I haven't tested it!!
</VirtualHost>

I expect (but I haven't tried it) you can also do
Listen 16.354.34.16:80
Listen 16.354.34.17:80

<VirtualHost 131.354.34.16>
...

<VirtualHost 131.354.34.17>

If you wanted Apache only to listen on the specified addresses, and not any
others.

I envisage the Listen syntax to be expanded to
Listen <address>:<port> [<protocol>]

where <protocol> is the name of an internal protocol reader which handles
the request, defaulting to http.

e.g.
Listen 21 ftp
Listen 443 https

 David.