[Linux-bruxelles] restart Apache2 failed (port 80 already in use)

Thomas Strömberg thomas at stromberg.org
Mar 16 Juin 15:08:18 CEST 2009


I apologize for responding in English (I hope Google Translate helps!):

In your example, ntp is using UDP:123, rather than TCP:80, though it does
match your grep command due to other output (IPV6 host?). A more precise
netstat command to confirm if port 80 is in use is:
% netstat -an | egrep ":80 " | grep "^tcp"
tcp6       0      0 :::80                   :::*                    LISTEN


Normally, with a webserver it would report LISTEN, though it is possible
that you may see another state (CLOSE_WAIT) if a service has shut down
incorrectly. If the netstat state shows LISTEN, a more precise way to find
out what is listening on a particular port is to use lsof:

% sudo lsof -i TCP:80
COMMAND   PID     USER   FD   TYPE  DEVICE SIZE NODE NAME
apache2 27663     root    3u  IPv6 3586415       TCP *:www (LISTEN)

It should normally output nothing, even with NTP running. If I understand
your post, apache worked fine after stopping NTP, which I think may be a
coincidence.

It is possible that in your apache2 configuration is set to listen on port
80 in two different locations. Try this command:

% grep -ir "^listen" /etc/apache2
/etc/apache2/ports.conf:Listen 80

You should only see one Listen statement for port 80, and possibly one
Listen for port 443 (SSL). If you see more than one Listen statement for
port 80, try commenting one of them out.

Best of Luck,
Thomas


2009/6/16 Didier MISSON <didier.misson at total.com>

>
> Bonjour,
>
> Je fais une mise à jour de mon serveur Ubuntu 8.04 :
> et il bloque au restart d' Apache2 :
>
>
> Dépaquetage de la mise à jour de apache2 ...
> Paramétrage de apache2-utils (2.2.8-1ubuntu0.8) ...
> Paramétrage de apache2.2-common (2.2.8-1ubuntu0.8) ...
>
> Paramétrage de apache2-mpm-prefork (2.2.8-1ubuntu0.8) ...
>  * Starting web server 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
>
>       [fail]
> invoke-rc.d: initscript apache2, action "start" failed.
>
>
>
> Paramétrage de apache2 (2.2.8-1ubuntu0.8) ...
> Lecture des listes de paquets... Fait
> Construction de l'arbre des dépendances
> Lecture des informations d'état... Fait
> Lecture de l'information d'état étendu
> Initialisation de l'état des paquets... Fait
> Construction de la base de données des étiquettes... Fait
>
>
> root at abrasd03:~# ps -A|grep apa
> root at abrasd03:~# /etc/init.d/apache2 start
>  * Starting web server 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
>
>       [fail]
>
>
> Je trouve une commande en cherchant dans Google pour voir qui utiliserait
> ce port :
>
>
> root at abrasd03:~# netstat --listening --programs --numeric-ports | grep 80
> udp6       0      0 fe80::21c:c0ff:fe43:123 :::*
>      3735/ntpd
>
> root at abrasd03:~# ntpq -p
>      remote           refid      st t when poll reach   delay   offset
>  jitter
>
> ==============================================================================
>  ntp1.belbone.be 195.13.23.6      2 u   21   64    3   10.695  -312.96
> 2.872
>  ntp2.belbone.be 195.13.23.6      2 u   50   64    1   11.648  -331.05
> 0.001
>  syrte8.obspm.fr 145.238.203.14   2 u   36   64    1   31.552  -318.08
> 0.001
> ...
>
> Effectivement, je fais un stop de ntpd
> et alors Apache2 redémarre sans problème avec la commande habituelle
> /etc/init.d/apache2 start
>
> Je redémarre ensuite ntp, et pas de problème.
>
> Question : comment ce fait-il que ntpd bloquait le port 80 ?
>
> Merci,
>
> Bon après-midi,
>
> --
> Didier MISSON
>
> Total Petrochemicals  Research Feluy
> IT - IS  Telecom
> Zone Industrielle C
> B - 7181 Feluy
> Belgium
> Phone : +32(0)64-51-4860
> Fax : +32(0)64-51-4243
> mailto:didier.misson at total.com
>
> ¨¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨¨°ºo§oº°¨¨¨¨
> --
> Linux-bruxelles mailing list
> Linux-bruxelles at lists.bxlug.be
> http://lists.bxlug.be/mailman/listinfo/linux-bruxelles
>
>


-- 
// thomas
-------------- section suivante --------------
Une pièce jointe HTML a été nettoyée...
URL: </pipermail/linux-bruxelles/attachments/20090616/47dd4b2d/attachment-0002.html>


Plus d'informations sur la liste de diffusion Linux-bruxelles