1

We have a web server with several apache instances listening on various ports (8080, 80801, 8082 for example).

we currently have an nginx instance listening on port 80 which takes in the requests and then proxies them to the proper instance port by domain name.

Would it be possible to do the same thing with iptables?

3 Answers 3

2

No; there is no concept of "destination domain" at the IP level, only destination IP address, so iptables cannot help you - nginx relies on the requested domain being transmitted as part of the URL in the HTTP request; but you can achieve the effect directly in apache, without requiring the nginx instance.

2

You can't do it. In a HTTP request the "domain" is conveyed in the Host: header which is Layer 7. iptables rules only have access to Layer 4 / TCP level info.

0

A clean way to set this up, if you can afford the additional address usage, is to have each domain point to a different IP address. Then configure all the addresses on this host, and let each instance of Apache bind to the port 80 of a single address (Use the syntax Listen Address:Port ) and you can remove nginx.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .