Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi, I just loaded the default configuration for apache2 on ubuntu 8.10 If I do a ' sudo netstat -tlnp ' , I see apache2 listening on port 80 and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21

    apache2 fails to stop


    Hi, I just loaded the default configuration for apache2 on ubuntu 8.10
    If I do a 'sudo netstat -tlnp' , I see apache2 listening on port 80 and 443 (i have ssl configured)
    I see the pid associated with apache2.
    Apache2 is not shutting down normally.
    If I do a 'sudo /etc/init.d/apache2 stop', i get the following message:
    Code:
    ubuntu@ubuntu-desktop:~$ sudo /etc/init.d/apache2 stop
     * Stopping web server apache2                                                  
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                             [ OK ]
    ubuntu@ubuntu-desktop:~$
    I have no idea where that ip address [127.0.1.1] is coming from (my local loopback is 127.0.0.1)

    Another netstat command shows apache2 is still up under the same pid.


    Of course I can manually shut it down using a force command, but that does not resolve the real problem. Where do I tell apache2 what my fully qualified domain name is?


    Thanks.

  2. #2
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    Are you using name based virtual host?

    When you use name based virtual host, you enter a value for "Server Name"
    in your vitual host configuration container, which is a FQDN- Fully qualified domain name.
    Your server is unable to listen on that server name, because it does not exist in DNS server you use.

    Just add entry in /etc/hosts with your FQDN and IP. or update the DNS( if you use your own dns)
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21
    B2B ...Thank you for your reply.

    I don't think i configured a named base virtual host, i just installed the default configuration.

    I did update my /etc/hosts and /etc/hostname
    with: 192.168.0.102 jim-desktop

    So my FQDN is jim-desktop and my ip is 192.168.0.102

    After I reboot, my apache2 is up and running but it must be running under a different DSN, because if I issue /etc/init.d/apache2 stop, it does not stop, and I still get the following message.
    apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.0.102 for ServerName


    If I force (sudo killall apache2), then issue /etc/init.d/apache2 start, apache2 starts and now uses the hostname designation. I can now start and stop apache2 normally.

    I suspect that on initial boot , apache2 is not using the hostname I designated in the hosts and hostname file.

    I have 2 questions:
    1. Where do I designate my machines "server's fully qualified domain name" for intial boot up?
    Note: I also have an encrypted certificate, so I'd expect on bootup I'd need to enter my
    passphrase, but I never see any dialog requesting that. When I manually stop and then
    start apache2, I do get a request to enter the passphrase.

    2. What script is running that issues the message noted in bold above?
    (I'd like to see what apache2 uses to try to determine the server's fqdn)

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    you should edit the httpd.conf file for apache and specify these things

  6. #5
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21
    Although the file httpd.conf does exist, there is no content. I've seen a post where the "new" default apache2 configuration setting are now in apache2.conf, but I noticed if one wants to extend that .conf file then there is code in apache2.conf to read the httpd.conf file.
    That being the case and not really knowing the correct syntax, I'll add an entry as "102.168.0.102 jim-desktop" and we'll see how that goes.

    Update: Through trial and error, I changed the httpd.conf entry to: ServerName jim-desktop:443
    This seems to satisfy the syntax.
    Last edited by jimf; 04-17-2009 at 10:58 PM. Reason: update information

  7. #6
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21
    OK, This where I lose most replies. I provide too much detail and then no one answers,, but here goes.

    These are the steps I took, followed by the terminal output.

    reboot
    1. check netstat (apache2 up and running)
    2. try displaying default web age - fails
    3. notice local address :::443 and :::80 (not correct)
    4. try normal stop /etc/init.d/apache2 stop (seems to work but)
    5. check netstat (apache2 still up and running)
    6. force stop issue killall apache2
    7. check status - netstat shows apache2 down
    8. start apache2 normal /etc/init.d/apache2 start (asks for passphrase - good)
    9. check status - netstat shows apache2 up with an IP address (not sure if o:o:o:443 is correct but)
    10. display default webpage - works!
    11. normal starting and stopping of apache2 works.

    Code:
    jim@jim-desktop:/etc/init.d$ sudo netstat -tlnp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      4669/cupsd      
    tcp6       0      0 :::80                   :::*                    LISTEN      5136/apache2    
    tcp6       0      0 :::443                  :::*                    LISTEN      5136/apache2    
    jim@jim-desktop:/etc/init.d$ sudo /etc/init.d/apache2 stop
     * Stopping web server apache2                                           [ OK ] 
    jim@jim-desktop:/etc/init.d$ sudo netstat -tlnp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      4669/cupsd      
    tcp6       0      0 :::80                   :::*                    LISTEN      5136/apache2    
    tcp6       0      0 :::443                  :::*                    LISTEN      5136/apache2    
    jim@jim-desktop:/etc/init.d$ sudo killall apache2
    jim@jim-desktop:/etc/init.d$ sudo netstat -tlnp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      4669/cupsd      
    jim@jim-desktop:/etc/init.d$ sudo /etc/init.d/apache2 start
     * Starting web server apache2                                                  Apache/2.2.9 mod_ssl/2.2.9 (Pass Phrase Dialog)
    Some of your private key files are encrypted for security reasons.
    In order to read them you have to provide the pass phrases.
    
    Server jim-desktop:443 (RSA)
    Enter pass phrase:
    
    OK: Pass Phrase Dialog successful.
                                                                             [ OK ]
    jim@jim-desktop:/etc/init.d$ sudo /etc/init.d/apache2 stop
     * Stopping web server apache2                                                   ... waiting .                                                           [ OK ]
    jim@jim-desktop:/etc/init.d$
    Would anyone like to guess what I need to do now to actually get apache2 up and running successfully with a valid IP on bootup?

    Thanks for reading the log anyway.

  8. #7
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    based on your last post I don't see the problem. apache is starting and stopping just fine (the error you were getting is harmless and apache would have worked anyway), when apache starts its listening on port 80 for every address on the machine.

    so whats left?

  9. #8
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21
    What's left?
    Well, when I first boot up, although apache2 is up, it fails to display the default web page (because at this time there is no ip address associated with the active pid). It stays in this failed mode until I manually kill the process and then do a "/etc/init.d/apache2 start", only then does the apache2 pid have an ip associated with it and only then it displays the default webpage.

    I'm thinking apache should work right after I boot up.

    Take a look at results from netstat right after boot

    tcp6 0 0 :::80 :::* LISTEN 5136/apache2
    tcp6 0 0 :::443 :::* LISTEN 5136/apache2


    Now compare the same (in bold) after a manual kill/restart
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9533/apache2
    tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 9533/apache2


    See what i'm talking about?
    It's the value displayed for the "local address" and even the foreign address data is different.

  10. #9
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108

    Lightbulb

    Both entries are for all matching IP addresses on your system not local. listening port 80 and 443.
    The difference is the following entry is of IPv6.
    Quote Originally Posted by jimf View Post
    What's left?
    Take a look at results from netstat right after boot

    tcp6 0 0 :::80 :::* LISTEN 5136/apache2
    tcp6 0 0 :::443 :::* LISTEN 5136/apache2
    And this one is for IPv4
    Quote Originally Posted by jimf View Post
    Now compare the same (in bold) after a manual kill/restart
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9533/apache2
    tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 9533/apache2
    I have a strong feeling that its not related to killing a process. you are getting confused somewhere
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  11. #10
    Just Joined!
    Join Date
    Mar 2008
    Posts
    21
    Thanks for your reply guys.

    Confused? yes, I think so.
    I'm just trying to find out what is different in the apache session on boot up when it does not work (fails to display default web page) and when I manually start it and it does work.

    I still don't understand why on manual start, I get asked for the pass phrase, yet on boot up I don't.

    Anyone know of a apache2 technical paper that may describe the init process in detail. From just looking at the scripts, I cannot see where the process detects that a pass phrase is needed and prompts for the input. That info may help.

    Thanks.

Page 1 of 2 1 2 LastLast

Posting Permissions

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