Find the answer to your Linux question:
Results 1 to 3 of 3
I've spent several hours on this. I keep getting this error when attempting to start apache's default web: Code: [root@fedora7vm ~]# httpd (98)Address already in use: make_sock: could not bind ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    18

    Angry Apache won't start!!


    I've spent several hours on this. I keep getting this error when attempting to start apache's default web:

    Code:
    [root@fedora7vm ~]# httpd
    (98)Address already in use: make_sock: could not bind to address [::]:80
    (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
    I've scoured Google and everybody says to use netstat to find a proc using port 80 and to kill it, but netstat -lnp | grep '0.0.0.0:80' reveals nothing. In fact, netstat -lnp | grep '80' reveals nothing. Executing netstat -lnp (without grep) reveals some listening processes but nothing on port 80.

    A few people also suggested manually adding the log file(s). For the life of me I cannot comprehend why on earth Apache would be incapable of creating its own *#$% log file, but I created it anyway. Still no change.

    I exec'd "yum remove httpd" and then "yum install httpd" and reinstalled the installed dependencies:

    BackupPC noarch 2.1.2-7.fc6 installed 1.7 M
    gnome-user-share i386 0.11-2.fc7 installed 104 k
    httpd-manual i386 2.2.4-4.1.fc7 installed 3.4 M
    mod_auth_mysql i386 1:3.0.0-3.1 installed 43 k
    mod_perl i386 2.0.3-9.1.fc7 installed 6.2 M
    mod_python i386 3.3.1-3 installed 1.5 M
    mod_ssl i386 1:2.2.4-4.1.fc7 installed 173 k
    php i386 5.2.2-3 installed 3.3 M
    system-config-httpd noarch 5:1.4.3-1.fc7 installed 2.4 M
    webalizer i386 2.01_10-32 installed 252 k

    Still failed.

    I've set both the Firewall and SELinux to Disabled, and after trying and failing again I rebooted with it disabled and it still failed.

    Doing all this logged in as root. Config file attached. Any ideas???

    Thanks,
    Jon
    Attached Files Attached Files

  2. #2
    Linux User DOllaBillz217's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    263
    Sometimes people have the "Listen 80" directive in two config files:


    /etc/httpd/conf/httpd.conf
    /etc/httpd/conf.d/system-config-httpd.conf

    The latter comes from the Fedora Core system configurator for httpd. Removing "Listen 80" from httpd.conf might solve the problem. Otherwise see if you have a line that says Listen :443 in your httpd.conf file. If you do then comment it out. And if for some reason them two dont work do the following :

    vi /etc/httpd/conf/httpd.conf

    and replace the port 80 and port 443 with
    port 80--->88
    port 443 --> 448 for the timebeing.

    to do quick find vi the file and than presh escap key and than put the ? question mark and than type 80 or 443 . to fine other 88 entry press n on the same time. anyhow let me kick ur ass now bcoz not suppose to teach all these things now..

    well when u replaced them than u simply run the command

    service htttpd restart
    again to confirm service httpd restart

    than see if it has started

    service httpd status...
    than u will see that ur webserver is started on port 88 and 448 for ssl. hummmmm

    now try to browse http://ipaddressof ur linuxbox:88
    http://ipadr:443

    u will see that ur page is cameup...hummmmmmm but problem is not solved yet.
    this teaches us that the prblem is with the port conflict..how can u track it..

    put the command

    lsif :80

    u will see the several process are already running on port 80 so apachea can't start on the same port. so u have to kill all these apachea process using kill -9 <processid>

    my logs:
    =======
    [root@ns root]# lsof -i :80
    COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
    xfs 19085 apache 18u IPv4 127053 TCP *:http (LISTEN)
    sh 19086 apache 18u IPv4 127053 TCP *:http (LISTEN)
    sh 19087 root 18u IPv4 127053 TCP *:http (LISTEN)
    su 19088 root 18u IPv4 127053 TCP *:http (LISTEN)
    bash 19089 root 18u IPv4 127053 TCP *:http (LISTEN)
    [root@ns root]# kil -9 19085 19086
    bash: kil: command not found
    [root@ns root]# kill -9 19085 19086
    [root@ns root]# lsof -i :80
    [root@ns root]# lsof -i :443
    [root@ns root]# lsof -i :443
    [root@ns root]#
    [root@ns root]#
    [root@ns root]#
    [root@ns root]#
    [root@ns root]#
    [root@ns root]# apachectl sto
    usage: /usr/sbin/apachectl (start|stop|restart|fullstatus|status|graceful|con figtest|help)

    start - start httpd
    stop - stop httpd
    restart - restart httpd if running by sending a SIGHUP or start if
    not running
    fullstatus - dump a full status screen; requires lynx and mod_status enabled
    status - dump a short status screen; requires lynx and mod_status enabled
    graceful - do a graceful restart by sending a SIGUSR1 or start if not running
    configtest - do a configuration syntax test
    help - this screen

    [root@ns root]# apachectl stop
    /usr/sbin/apachectl stop: httpd (no pid file) not running
    [root@ns root]# apachectl start
    /usr/sbin/apachectl start: httpd started
    [root@ns root]# lsof -i :443
    COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
    httpd 24957 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24958 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24959 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24960 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24961 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24962 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24963 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24964 root 19u IPv4 479222 TCP *:https (LISTEN)
    httpd 24965 root 19u IPv4 479222 TCP *:https (LISTEN)
    [root@ns root]# lsof -i :80
    COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
    httpd 24957 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24958 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24959 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24960 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24961 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24962 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24963 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24964 root 18u IPv4 479221 TCP *:http (LISTEN)
    httpd 24965 root 18u IPv4 479221 TCP *:http (LISTEN)
    [root@ns root]# service httpd status
    httpd (pid 24965 24964 24963 24962 24961 24960 24959 24958 24957) is running...
    [root@ns root]# ls
    anaconda-ks.cfg dead.letter Linux_Backup mail Mail nsmail
    [root@ns root]# cd /etc/httpd/config
    bash: cd: /etc/httpd/config: No such file or directory
    [root@ns root]# ls
    anaconda-ks.cfg dead.letter Linux_Backup mail Mail nsmail
    [root@ns root]# cd /etc/httpd
    [root@ns httpd]# cd conf
    [root@ns conf]# ls


    Why this problem comes:
    -------------------------------
    this problem is comes only if u started the weberver and than made some modification or tried to load the jsp or asp support than u will find http locked when u tried to restart it .

    so don't be confussed. just kill th process and than put ur configuration (original file) which has port 80 or 443.

    it will work fine......
    $Billz

    How much wood would a wood chuck chuck if a wood chuck could chuck wood? None they eat plants!

    Dell Optiplex GX260, LTSP Diskless Workstation, Fedora Core 6

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    18
    Heh, thanks. Yeah I had just managed to figure this one out (with someone's help) before I came back here and saw your post, but you're right on:

    Sometimes people have the "Listen 80" directive in two config files:

    /etc/httpd/conf/httpd.conf
    /etc/httpd/conf.d/system-config-httpd.conf

    The latter comes from the Fedora Core system configurator for httpd. Removing "Listen 80" from httpd.conf might solve the problem.
    This is a bug in Fedora v7 https://bugzilla.redhat.com/bugzilla....cgi?id=244887

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •