Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HELP - apache could not bind to address 0.0.0.0:80 SOLVED
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 3:20 am    Post subject: HELP - apache could not bind to address 0.0.0.0:80 SOLVED Reply with quote

I am setting up a new web server that is basicly a clone of an 8 year old machine. The idea is to migrate to new hardware, but keep the web server basicly the same. I emerged www-servers/apache-2.2.25 and copied the directory tree below /etc/apache2 from the old server. I edited all the places I could find where the server domain name or ip address appeared (I grepped for them), and changed them to the temporary ip address the new server is using on my lan for testing during bring-up.

But when I try to start it, this is what I get:
Code:

hophni etc # /etc/init.d/apache2 status
 * status: stopped
hophni etc # ps ax | grep apache
 2750 pts/0    S+     0:00 grep --colour=auto apache
hophni etc # /etc/init.d/apache2 start
 * Starting apache2 ...
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2'                                                         [ ok ]
hophni etc #

The system log file shows:
Code:

Jul 23 23:18:50 hophni /etc/init.d/apache2[2761]: start-stop-daemon: failed to start `/usr/sbin/apache2'

I know I shoudl be able to figure this out, but I am loosing patience with it; can anybody help me get this thing to start?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.


Last edited by Moriah on Wed Jul 24, 2013 1:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jul 24, 2013 3:34 am    Post subject: Reply with quote

as root run & post output of

Code:

netstat -ltnp | grep ':80'


(to show whats running on port 80)
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 3:40 am    Post subject: Reply with quote

Nothing has that port open:
Code:

hophni ~ # netstat -ltnp | grep ':80'
hophni ~ #

So, anticipating your next question, here it is without the grep:
Code:


hophni ~ # netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1905/sshd           
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      1966/sshd: root@pts
hophni ~ #

:?
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jul 24, 2013 4:13 am    Post subject: Reply with quote

no it was actually post output of this command

Code:

cat /etc/hosts
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 4:15 am    Post subject: Reply with quote

Unfortunately, I cannot post the entire output of that file for security reasons, but I could post an excerpt, if you can tell me what you are looking for.
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jul 24, 2013 4:18 am    Post subject: Reply with quote

# IPv4 and IPv6 localhost aliases
127.0.0.1 localhost mksrv

(im looking to make sure you have an alias set)

yours should be
127.0.0.1 localhost hophni
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 4:22 am    Post subject: Reply with quote

Here is what I think you want to see:
Code:

hophni ~ # grep hoph /etc/hosts
192.168.1.12            hophni          hophni.elilabs.com
hophni ~ # grep localhost /etc/hosts
127.0.0.1       localhost.localdomain   localhost
hophni ~ # grep 127 /etc/hosts
127.0.0.1       localhost.localdomain   localhost

So I do not seem to have what you say I need. :(
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 4:25 am    Post subject: Reply with quote

So I added this:
Code:

127.0.0.1      localhost   hophni

to /etc/hosts and it still does the same thing:
Code:

hophni ~ # ps ax | grep apache
 3355 pts/0    S+     0:00 grep --colour=auto apache
hophni ~ # /etc/init.d/apache2 status
 * status: stopped
hophni ~ # /etc/init.d/apache2 start
 * Starting apache2 ...
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2'                                                         [ ok ]
hophni ~ #

_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jul 24, 2013 4:26 am    Post subject: Reply with quote

(all as root)

Code:

echo "127.0.0.1 localhost hophni" >> /etc/hosts


new terminal, then try rc-service apache restart

(also whats ping -c 5 0.0.0.0 showing?)

for me mkultra@mksrv [ ~ ]$ ping -c 5 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 4:32 am    Post subject: Reply with quote

Not sure what you mean by:

"new terminal, then try rc-service apache restart"

But I guess you saw our posts crossed in the mail, so to speak...

Also:
Code:

hophni ~ # ping -c 5 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.015 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.010 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.012 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.028 ms

--- 0.0.0.0 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3997ms
rtt min/avg/max/mdev = 0.010/0.018/0.028/0.009 ms
hophni ~ #

_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Wed Jul 24, 2013 4:47 am    Post subject: Reply with quote

Code:

 equery l apache -p
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 4:58 am    Post subject: Reply with quote

Code:

hophni apache2 # equery l apache -p
 * Searching for apache ...
[-P-] [  ] www-servers/apache-2.2.24:2
[-P-] [ ~] www-servers/apache-2.2.24-r1:2
[IP-] [  ] www-servers/apache-2.2.25:2
[-P-] [ ~] www-servers/apache-2.4.4:2
[-P-] [ ~] www-servers/apache-2.4.4-r3:2
[-P-] [ ~] www-servers/apache-2.4.6:2
hophni apache2 #

_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2365
Location: Kentucky

PostPosted: Wed Jul 24, 2013 1:36 pm    Post subject: Reply with quote

Found it!

It was in /etc/apache2/vhosts.d/ssl-vhost.conf:
Code:

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
#Listen 80
#Listen 192.168.1.12:80

The last "Listen" was not commented out. It is now, and it now works.

Thanks for the help! :D
_________________
The MyWord KJV Bible tool is at http://www.elilabs.com/~myword

Foghorn Leghorn is a Warner Bros. cartoon character.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum