LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-31-2006, 08:08 AM   #1
ganz_friedrich
Member
 
Registered: Dec 2005
Posts: 47

Rep: Reputation: 16
How do you get apache to listen on other IP addresses?


The server has 4 ip addresses. Apache is only listening on the first in the range (despite the wildcard *:80 being used in httpd.conf).

I want to set up a virtual host and bind it to one of the other ip addresses.

Thank you
 
Old 03-31-2006, 08:27 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

That's easy

One of Apache's related web pages.

Google would have given you the answer in no time flat.

Anyways,

Hope this helps.
 
Old 03-31-2006, 08:30 AM   #3
lurker79
Member
 
Registered: Jan 2005
Location: UK
Posts: 55

Rep: Reputation: 16
In httpd.conf:

Listen 80

Will cause Apache to listen on all interfaces (on all ip addresses) to listen on a specific ip address change this to something like

Listen 192.168.0.133:80
 
Old 03-31-2006, 08:52 AM   #4
ganz_friedrich
Member
 
Registered: Dec 2005
Posts: 47

Original Poster
Rep: Reputation: 16
As I said "despite the wildcard *:80 being used in httpd.conf". I.e. the problem does not appear to be with the apache configuration.

When trying to access one of the other IP addresses with a web browser, it just hangs and says the server is taking too long to respond.
 
Old 03-31-2006, 09:13 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Wildcard????

A wildcard is not allowed.

It's:
Listen 80

or

Listen 1.2.3.4:80
Listen 12.13.14.15:80
Listen 192.170.2.1:80
<etc>

As stated in the url I posted before...........

To check if apache is listening (and on which port(s)/ip(s)): netstat -a -n | grep ":80 "
 
Old 03-31-2006, 09:41 AM   #6
ganz_friedrich
Member
 
Registered: Dec 2005
Posts: 47

Original Poster
Rep: Reputation: 16
I appreciate your help

I was referring to the syntax in the VirtualHost directive. But yes, there is "listen 80" not changed from the default, in the main configuration.

netstat produces:

tcp 0 0 :::80 :::* LISTEN

I believe this means to listen on all available ip addresses. Although I notice some other services e.g. mysql have 0.0.0.0 instead of :::

again, thanks for your help

(by the way, if it makes any difference, I am using apache2)
 
Old 03-31-2006, 10:29 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
tcp 0 0 :::80 :::* LISTEN
That looks like a ipv6 notation. Square brackets (in your httpd.conf) could cause this.

Take a look here:

ipv6/apache

It's a link about how to set up ipv6, but maybe you can check entries in your httpd.conf against what's told there and remove/change the 'corrupt' (example??) entry.

Does it work with just one ip (Listen 1.2.3.4:80)??

Hope this helps.

listen / apache 2.0

Last edited by druuna; 03-31-2006 at 10:32 AM.
 
Old 03-31-2006, 11:22 AM   #8
ganz_friedrich
Member
 
Registered: Dec 2005
Posts: 47

Original Poster
Rep: Reputation: 16
There are no square brackets in the configuration.

Apache listens fine on the first IP in the range.

I tried specifically with just one of the other ips as you suggested and got an error "could not assign requested address: make_sock: could not bind to address...".

Perhaps the server does not acknowledge the other ips - does not know they are there? Is there a configuration to tell it which ip addresses it has, or does it just know automatically? (The hosting company set up the server and I am sure they knew what they were doing).
 
Old 03-31-2006, 01:05 PM   #9
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Quote:
Originally Posted by druuna
Hi,

A wildcard is not allowed.
Really! I guess that apache docs need to be updated then, and the apache binary has to be scolded for not functioning correctly!

Seriously though, if you have something like:

Listen *:80

Then Apache will listen on all IP addresses (on that machine) on port 80.

Just FYI.
 
Old 03-31-2006, 01:33 PM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@KimVette: I do agree that it seems to work. Just tried it

I truly don't know if the *.80 notation is a proven concept and should be added/corrected in the manuals. And if unsure its always wise to remove the undocumented stuff and use documented settings only.

I wonder how the Apache people would react if we filed a bug report
 
Old 04-02-2006, 08:14 AM   #11
ganz_friedrich
Member
 
Registered: Dec 2005
Posts: 47

Original Poster
Rep: Reputation: 16
I figured it out. I needed to set-up an IP aliase for the other IP using ifconfig. The command goes like this:

ifconfig eth0:0 ***.***.***.***

where ***.***.***.*** is the ip address.

If anyone comes across this thread with a similiar problem. Do a search on setting up ip aliases with ifconfig. You may also need to also set up a route (with the route command) to the ip, but ifconfig seemed to do this automatically for me.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why won't Apache accept and additional Listen ports? mikeghet Linux - Networking 22 11-08-2005 10:06 PM
Apache 'Listen' directive doesn't work robbiemorgan Linux - Software 0 11-22-2004 11:49 AM
DNS Listen on too many ip addresses tysonh04 Fedora 2 03-15-2004 09:54 AM
Apache doesn't listen to 443 (https) yapp Linux - Networking 5 07-03-2003 06:23 PM
Apache canīt listen to external IP Baalbeck Linux - Networking 4 03-07-2003 03:42 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration