13

Apache didn't start up automatically like it usually does. I'd like to try to find out why. It looks like it never started up today, so nothing in /var/log/apache2/error.log since it never ran. As I understand it, the apache script is /etc/init.d/apache2 so I'd like to find some messages somewhere regarding this script. However, I can't find anything in /var/log/messages or the syslog.

Is there anywhere in the system where it says "Yep, I'm starting up /etc/init.d/apache2 now; it worked" or especially "It didn't work and here's why!" ?

I am using Ubuntu Release 10.04 (lucid), Kernel Linux 2.6.32-38, and GNOME 2.30.2 .

2
  • Did you check /var/log/syslog? Apr 7, 2012 at 0:36
  • Yes, that's what I meant when I wrote "syslog" at the end of my first paragraph.
    – Roy
    Apr 7, 2012 at 3:40

4 Answers 4

4

You could go to a terminal and type in "sudo /etc/init.d/apache2 restart" in a terminal, and see what kind of error message you get. One common reason, I believe, is because of some module that was either added, changed, or had a change made to a corresponding config file (such as php.ini). If all else fails, go to the directory /etc/apache2/mods-enabled, and move module links out into a temporary directory, and if apache starts, you can put them back one by one.

Be aware, though, that the error message may be misleading. It may get an error loading a module not because the module is bad, but because it's configuration file is bad.

2
  • 1
    Thanks! This helped me find out what was wrong. It was not a change to the Apache modules. Instead, it was looking for a configuration file in /etc/apache2/conf.d that got removed (i.e. there was a symbolic link to something that got removed). I did get an error message on the terminal which cleared this up, but I wonder if these messages are logged anywhere? I verified that they aren't in any of the log files you get in Log File Viewer (messages, syslog, user log, etc.)
    – Roy
    Apr 7, 2012 at 3:46
  • 1
    Glad I was able to help. I don't know which log it might be in, but I would have guessed something in /var/log/apache2/error.log. Personally, if something doesn't run, I tend to use the terminal to try running it, and see what it says. That seems to usually work for me, without needing to search for a bunch of log files to find the right one. Apr 7, 2012 at 5:24
2

from:

View log files in Ubuntu Linux
http://www.cyberciti.biz/faq/ubuntu-linux-gnome-system-log-viewer/

/var/log/apache2/*  :  Apache web server log files directory
1
  • I referenced /var/log/apache2/error.log in my question. Those logs weren't the answer as I mentioned.
    – Roy
    Apr 7, 2012 at 4:04
1

Typically you will get a message like this:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

So all you need to do is run:

journalctl -xe

Then you should see an output similar to this

Nov 16 03:27:26 naboo sudo[9909]: pam_unix(sudo:session): session opened f
Nov 16 03:27:28 naboo systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has begun starting up.
Nov 16 03:27:29 naboo apachectl[9939]: (98)Address already in use: AH00072
Nov 16 03:27:29 naboo apachectl[9939]: no listening sockets available, shu
Nov 16 03:27:29 naboo apachectl[9939]: AH00015: Unable to open logs
Nov 16 03:27:29 naboo apachectl[9939]: Action 'start' failed.
Nov 16 03:27:29 naboo apachectl[9939]: The Apache error log may have more 
Nov 16 03:27:29 naboo systemd[1]: apache2.service: Control process exited,
Nov 16 03:27:29 naboo systemd[1]: apache2.service: Failed with result 'exi
Nov 16 03:27:29 naboo systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has failed.
-- 
-- The result is RESULT.
Nov 16 03:27:29 naboo sudo[9909]: pam_unix(sudo:session): session closed f
0

I wasn't getting any error messages, but source /etc/apache2/envvars && /usr/sbin/apache2 worked for me. (on Debian)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .