Ashish Aggarwal Ashish Aggarwal - 1 month ago 17
Apache Configuration Question

Binding IP in apache

Actually I am a beginner to the concept of virtualhost in apache so forgive me if I am being silly here. My question is :-

Is there a way that I can bind apache to listen on public IP/network interface of other server like

Listen 54.27.123.255:80


Generally we use :


Listen 80
Listen 127.0.0.1:80

Answer

If you have multiples IP addresses on the one machine (e.g. multiple NIC cards) then you can use that syntax to have Apache, or certain vhosts in Apache, to only listen on one. For example you could have one vhost serving a site on one IP address and another vhost serving a different site on a different IP address which also resolves to that server. If you do not supply an IP address but just a port then Apache will listen to all IP addresses.

What you cannot do is use that syntax to steal network traffic for an IP address associated with another server - to do that Apache would need to be running on the server that IP address is associated with.

Comments