LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-22-2008, 01:22 AM   #1
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Rep: Reputation: 30
Apache on localhost with no internet connection - not starting


I'm trying to run Apache on a laptop. It's setup to listen on localhost:80, but it will not start unless there is an active internet connecection. It spits out an error about the address format not being valid, and then it fails to start Apache. (Sorry I don't have the actual error, but the laptop is not in front of me now.) When I connect to a wifi hotspot or via ethernet, Apache starts with no errors.

Will Apache simply not run without being internet connected? Or do I need to modify the /etc/hosts file or DNS setup in some way?

--Akshun J
 
Old 05-22-2008, 03:52 AM   #2
toaravind
LQ Newbie
 
Registered: May 2008
Posts: 21

Rep: Reputation: 0
I am sure Apache works without Internet connection. Please look out for any scary errors in the log files (httpd). It should help to solve the problem.
 
Old 05-22-2008, 11:10 AM   #3
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Original Poster
Rep: Reputation: 30
That's the weird part. I don't get any errors in the log file. Just that initial failure message where apache fails. Suggestions?
 
Old 05-22-2008, 11:31 AM   #4
ayush1440
Member
 
Registered: Dec 2007
Posts: 75

Rep: Reputation: 15
which os do you use for this? Apache is starting properly or not? see logs for that. what apache log says?
 
Old 05-22-2008, 11:54 AM   #5
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Original Poster
Rep: Reputation: 30
I'm trying to help a friend out with his Mandriva laptop. The error logs for Apache are not saying anything, and Apache is not starting. I will post the error message that appears on the commandline when startup fails in a few minutes when I get in to work... Thanks!

--Akshun J
 
Old 05-22-2008, 12:28 PM   #6
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Original Poster
Rep: Reputation: 30
Below is the error...

Starting httpd: [Thu May 22 11:24:36 2008] [crit] (EAI 9)Address family for hostname not supported: alloc_listener: failed to set up sockaddr for 127.0.0.1
Syntax error on line 160 of /etc/httpd/conf/httpd.conf:
Listen setup failed

And my line 160 reads:

Listen 127.0.0.1:80

So, I'm not sure what the issue is. Any advice?

--Akshun J
 
Old 05-22-2008, 02:13 PM   #7
mtimbro
Member
 
Registered: Feb 2008
Location: Montreal, Canada
Distribution: RedHat 3/4, Ubuntu 7.10
Posts: 86

Rep: Reputation: 15
Quote:
Originally Posted by akshunj View Post
Below is the error...

Starting httpd: [Thu May 22 11:24:36 2008] [crit] (EAI 9)Address family for hostname not supported: alloc_listener: failed to set up sockaddr for 127.0.0.1
Syntax error on line 160 of /etc/httpd/conf/httpd.conf:
Listen setup failed

And my line 160 reads:

Listen 127.0.0.1:80

So, I'm not sure what the issue is. Any advice?

--Akshun J
Just a quick question:

With which user do you try to start apache on port 80 ? Because that's a privileged port and nothing besides root can do such a thing.
 
Old 05-23-2008, 12:58 AM   #8
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Original Poster
Rep: Reputation: 30
Permissions was not an issue. I was starting Apache as root, and wanted it to start on-boot. However, I fixed the problem.

I changed both the httpd.conf file and the ssl config file to both listen for *:80. This solved the problem. I think they just needed to both be listening for the same port with the same address format. Thanks for the suggestions, though...

--Akshun J
 
Old 03-02-2010, 09:39 AM   #9
realaaa
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Rep: Reputation: 0
I have exactly the same problem on Gentoo release 1.12.13 with Apache 2.2.14-r1

Apache won't start when there is no Internet connection, fails with:

Quote:
# /etc/init.d/apache2 restart
* apache2 has detected a syntax error in your configuration files:
[Tue Mar 02 23:26:09 2010] [crit] (EAI 9)Address family for hostname not supported: alloc_listener: failed to set up sockaddr for 127.0.0.1
Syntax error on line 9 of /etc/apache2/vhosts.d/00_default_ssl_vhost.conf:
Listen setup failed
line 9 above is merely a "Listen 127.0.0.1:443"

I tried everything after Listen - localhost, *, 0.0.0.0, etc, it doesn't work.

But the real question is - why does it work and start up when there is connection to Internet??
 
Old 03-02-2010, 09:45 AM   #10
jwl17330536
Member
 
Registered: Feb 2010
Location: Raleigh, NC
Posts: 83

Rep: Reputation: 22
In your httpd.conf

Try:

Listen 80

Rather than:

Listen 127.0.0.1:80
 
Old 03-02-2010, 10:04 AM   #11
realaaa
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Rep: Reputation: 0
Thanks jwl17330536!

"Listen 80" alone didn't help, but when I set both Listen directives to just 80 and 443:

Quote:
# grep -iR listen /etc/apache2/
/etc/apache2/vhosts.d/00_default_vhost.conf:# Listen: Allows you to bind Apache to specific IP addresses and/or
/etc/apache2/vhosts.d/00_default_vhost.conf:# Change this to Listen on specific IP addresses as shown below to
/etc/apache2/vhosts.d/00_default_vhost.conf:#Listen 12.34.56.78:80
/etc/apache2/vhosts.d/00_default_vhost.conf:#Listen 127.0.0.1:80
/etc/apache2/vhosts.d/00_default_vhost.conf:Listen 80
/etc/apache2/vhosts.d/00_default_vhost.conf:#Listen localhost:80
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:# When we also provide SSL we have to listen to the HTTPS port
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:#Listen 127.0.0.1:443
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:#Listen localhost:143
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:#Listen 0.0.0.0:443
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:#Listen _default_:443
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:#Listen *:443
/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:Listen 443
It started up! With almost the same messages btw:

Quote:
# /etc/init.d/apache2 restart
* Starting apache2 ...
[Tue Mar 02 23:54:07 2010] [error] (EAI 9)Address family for hostname not supported: Could not resolve host name 127.0.0.1 -- ignoring!
[Tue Mar 02 23:54:07 2010] [error] (EAI 9)Address family for hostname not supported: Could not resolve host name 127.0.0.1 -- ignoring!
[Tue Mar 02 23:54:07 2010] [error] (EAI 9)Address family for hostname not supported: Could not resolve host name 127.0.0.1 -- ignoring!
[Tue Mar 02 23:54:07 2010] [error] (EAI 9)Address family for hostname not supported: Could not resolve host name 127.0.0.1 -- ignoring!
apache2: apr_sockaddr_info_get() failed for realaaa
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ ok ]
If anybody can explain this behavior I would be most grateful
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Localhost apache connection refused TuxLives Mandriva 3 04-17-2006 04:59 PM
internet connection not starting at boot paul62 Debian 2 11-25-2005 01:13 AM
Apache works localhost but not over the internet newuser455 Red Hat 4 05-22-2004 12:04 PM
connection to localhost in apache? yadafarin Linux - Networking 3 02-05-2004 01:56 PM
Starting Internet Connection at Startup OutlawStar Linux - Newbie 1 06-09-2003 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration