Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My server has two IP addresses, and I want two Apache services listening to each one separately. The DNS has this:

  1. a CNAME alias pointing 'intranet' to servername
  2. a Host (A) record pointing servername to IP 1
  3. a Host (A) record pointing 'dev' to IP 2

I have an Apache service running with Listen intranet:80, but it has decided to listen on IP 1 and IP 2, so I can't start the second service. How did it even get to IP 2 when the path through DNS should just lead it to IP 1? My guess is that it resolves to 127.0.0.1 and then binds to all IPs available. If that's the case, will Listen IP1:80 actually force it not to use IP 2, or will the same logic apply and it will use all available IPs? If the latter, is there actually a way to configure Apache to only listen on IP 1? (I only ask rather than experiment, because this is a live system and I don't want to cause more downtime than I need to.)

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Use Listen IP1:80 and it will only bind to that IP.

http://httpd.apache.org/docs/2.2/bind.html

When Apache starts, it binds to some port and address on the local machine and waits for incoming requests. By default, it listens to all addresses on the machine. However, it may need to be told to listen on specific ports, or only on selected addresses, or a combination of both.

share|improve this answer
    
Now that I go and do it, I realize that other services I have which have versioned httpd.conf files also use Listen with a name. I don't suppose there's a way to do it without touching the other httpd.confs at the moment, like some Windows filter? –  Kev Mar 28 '13 at 17:54
    
What sort of other programs? –  NickW Mar 28 '13 at 17:56
    
Like other Apache services I didn't mention originally. –  Kev Mar 28 '13 at 18:03
    
On the same machine, or is it on different servers? –  NickW Mar 28 '13 at 18:08
    
Hey, I'm off for the night, I'll try and look in on this tomorrow! –  NickW Mar 28 '13 at 18:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.