Forum Moderators: phranque
I have server which has w interfaces (2 different ip's)
In configuration file i have:
Listen xx.xx.xx.xx:80
Listen yy.yy.yyy.yy:80
so apache listen on both interfaces.
Problem is that outgoing traffic from server is served thru one interface (xx.xx.xx.xx).
How can i force apache to serve outgoing traffic thru right interface depends on requested domain?
Example:
If someone request example.com (which is pointed to xx.xx.xx.xx) outgoing traffic goes thru interface1 (eth0)
But if someone request elpmaxe.moc (which is pointed to yy.yy.yyy.yy) outgoing traffic goes thru interface2 (eth1)
Any help will be appriciated.
Regards, japhar
Either way, I think you'll want to define the IP address at the VirtualHost level, and not using "Listen".
Jim
This is how i have configured my virtual hosting using Apache 2.2.4.
/usr/local/apache2/conf/httpd.conf
Listen xx.xx.xx.xx:80
Listen yy.yy.yy.yy:80
According to online documentation Listen directive is required.
NameVirtualHost xx.xx.xx.xx
NameVirtualHost yy.yy.yy.yy
Then i start configuring my virtual host:
<VirtualHost xx.xx.xx.xx>
...
</VirtualHost>
<VirtualHost yy.yy.yy.y>
...
</VirtualHost>
etc etc.
All works fine, but the problem is that outgoing traffic goes thru first NIC which has ip: xx.xx.xx.xx
Here's some ifconfig results:
eth0 (xx.xx.xx.xx)
RX bytes:2893274010 (2.6 GiB) TX bytes:2060233362 (1.9 GiB)
eth1 (yy.yy.yy.yy)
RX bytes:1876431674 (1.7 GiB) TX bytes:7496 (7.3 KiB)
As you cen see all goes thru eth0. Am i missing something in my configuration?
Thanks in advace, japhar
Your config basically looks OK, but without an answer to the above question, all I can do is to refer you to the last major paragraph here [httpd.apache.org]. Where you go from there depends on whether you intend to set up more than one server per IP address.
Jim
I'm trying to implement name-based virtual hosts. Cant afford to have different IPs for every vhost. Basicly i moved 2 servers to one machine which have 2 NICs and i want to keep the kinda separate if u know what i mean.