On Sat, 2007-08-04 at 19:50 +0100, Matthew wrote:
Simon wrote: As for getting it to start automatically, are you sure it isn't already? Try `netstat -at` after a fresh boot to see if something is listening on 'www'.
root@wildebeest:~# netstat -at Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:2208 *:* LISTEN tcp 0 0 localhost:mysql *:* LISTEN tcp 0 0 *:2317 *:* LISTEN tcp 0 0 localhost:ipp *:* LISTEN tcp 0 0 localhost:2207 *:* LISTEN
If not, look for directories called /etc/rc{n}.d, for various {n} being the runlevels your system will do. These contain symlinks to the scripts in /etc/init.d and determine which services are started/killed when entering/leaving different runlevels.
Rather than clutter this email with this long printout I have put the output of ls -l /etc/rc* on the net as: www.suffolk-ancestor-genealogy-research.co.uk/alug/ls_of_etc_rc.txt if you would like to take a look.
I have also put the output of ls -l /etc/init.d as: www.suffolk-ancestor-genealogy-research.co.uk/alug/ls_of_initd.txt
Either the installer didn't put the links in, or it made them for the wrong runlevel. You can probably use `who -r` to check your current runlevel (or `runlevel` as root).
root@wildebeest:/# runlevel N 2 root@wildebeest:/# who -r run-level 2 2007-08-06 06:42 last=
So, if I understand you correctly Matthew, you are saying that "who -r" shows I am currently at "Run Level 2" so the start-up scripts that would have been run are in /etc/rc2.d.
If I do an ls -l of /etc/rc2.d I see the contents of: www.suffolk-ancestor-genealogy-research.co.uk/alug/ls_of_etc_rc2d.txt
Looking at this I can see an entry for apache2 but also, confusingly, entries for apache. As far as I am aware I only have apache2, not apache, on my system:
root@wildebeest:/# ls -l /etc/rc2.d/S91* lrwxrwxrwx 1 root root 16 2007-07-27 20:39 /etc/rc2.d/S91apache -> ../init.d/apache lrwxrwxrwx 1 root root 17 2007-07-27 20:55 /etc/rc2.d/S91apache2 -> ../init.d/apache2 lrwxrwxrwx 1 root root 21 2007-07-27 20:46 /etc/rc2.d/S91apache-perl -> ../init.d/apache-perl lrwxrwxrwx 1 root root 20 2007-07-27 20:43 /etc/rc2.d/S91apache-ssl -> ../init.d/apache-ssl
If I manually run /etc/init.d/apache2 nothing happens: www.suffolk-ancestor-genealogy-research.co.uk/alug/output_of_etc_initd_apache2.txt
If I look at the contents of /etc/init.d/apache2 I see: www.suffolk-ancestor-genealogy-research.co.uk/alug/etc_initd_apache2.txt
and notice that it says at the top:
# apache2 This init.d script is used to start apache2. # It basically just calls apache2ctl.
I therefore assume that this script should give the same result as running apache2ctl. This is not however the case because if I run apache2ctl manually then it does in fact start apache:
root@wildebeest:/# /usr/sbin/apache2ctl restart apache2: apr_sockaddr_info_get() failed for wildebeest apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName httpd not running, trying to start
And if I now do a netstat and ps I can see it has now started running: www.suffolk-ancestor-genealogy-research.co.uk/alug/ps_after_apache2ctl_restart.txt
root@wildebeest:/# netstat -at Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:2208 *:* LISTEN tcp 0 0 localhost:mysql *:* LISTEN tcp 0 0 *:2317 *:* LISTEN tcp 0 0 *:www *:* LISTEN tcp 0 0 localhost:ipp *:* LISTEN tcp 0 0 localhost:2207 *:* LISTEN
Use update-rc.d to make the links in the proper formats: check its man-page for options you might want.
I think, going through the hints that you have given me above, it seems to me that /etc/init.d/apache2 exists, and a link to it exists in /etc/rc2.d however this apache2 script is not behaving the same as running apache2ctl manually from the command line. Is there anyone on the ALUG list who could suggest some ways I can debug this default apache2 startup script to see why it is not behaving as it should?
Hope that helps,
Matthew
Yes Matthew, I think your reply has helped me understand better how Apache starts and has perhaps narrowed down my problem to the /etc/init.d/apache2 script. The problem now is trying to suss out why this script isn't behaving as expected; especially bearing in mind I haven't touched this script so it should be a virgin file put there during my Ubuntu installation.
Any suggestions would be appreciated.
Sagr.