Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

port - Starting apache fails (could not bind to address 0.0.0.0:80)

Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled.

I have Ubuntu 11.10

When I run the command to start apache2:

sudo /etc/init.d/apache2 start

I get the following error message:

Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (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 Action 'start' failed.

I run this command in order to get the process that is using the port 80:

sudo netstat -ltnp | grep ':80'

Which returns this output:

tcp6       0      0 :::80                   :::*                    LISTEN      1176/

To know which process is I run this command:

ps -wlp1176

That returns:

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
5 D    33  1176     1  0  80   0 -     0 exit   ?        00:00:00 apache2

But if I try to kill the process:

sudo kill -9 1176

It doesn't kill it, if I run again the netstat command still appears listening and apache start fails.

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Worked for me running this command:

fuser -k -n tcp 80

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...