LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache on localhost with no internet connection - not starting (https://www.linuxquestions.org/questions/linux-server-73/apache-on-localhost-with-no-internet-connection-not-starting-643941/)

akshunj 05-22-2008 12:22 AM

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

toaravind 05-22-2008 02:52 AM

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.

akshunj 05-22-2008 10:10 AM

That's the weird part. I don't get any errors in the log file. Just that initial failure message where apache fails. Suggestions?

ayush1440 05-22-2008 10:31 AM

which os do you use for this? Apache is starting properly or not? see logs for that. what apache log says?

akshunj 05-22-2008 10:54 AM

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

akshunj 05-22-2008 11:28 AM

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

mtimbro 05-22-2008 01:13 PM

Quote:

Originally Posted by akshunj (Post 3161506)
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.

akshunj 05-22-2008 11:58 PM

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

realaaa 03-02-2010 08:39 AM

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??

jwl17330536 03-02-2010 08:45 AM

In your httpd.conf

Try:

Listen 80

Rather than:

Listen 127.0.0.1:80

realaaa 03-02-2010 09:04 AM

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


All times are GMT -5. The time now is 08:22 PM.