6

Apache is already set up as a service, since:

$ sudo update-rc.d apache2 defaults
 System start/stop links for /etc/init.d/apache2 already exist.

But Apache isn't starting. How can I start debugging what is going wrong?

I'm running Linux Mint, so a Debian flavour.

1

3 Answers 3

6

Start by looking at the error log tail -15 /var/log/apache2/error.log

If that doesn't give a hint such as ports being unavailable or so, run apache2ctl -t to test your config.

If your config is good, check to see if any process is already bound to port 80 or 443 (which is probably the ports you want apache on). The last column of the output will be $PID/$process_name.

   sudo netstat -tlpne | egrep ':(80|443)'

Alternatively, see if Apache is running but listening on other ports...

  sudo netstat -tlpne | grep apache

If you still haven't sorted it out by now, it wouldn't hurt to check that Apache is configured to the domains you expect, so run apache2ctl -S and you should see a list of configured domains. If your domain/port combination isn't listed there, you'll want to sort out your config.

There're more still, but these will reveal many common configuration problems.

1
  • Thanks, but no fix. The only complaint Apache had was being unable to resolve ServerName, so I set it to localhost in httpd.conf. Now that warning is not showing, but no joy. No, there isn't something running on 80/443. Yes, the syntax is correct. Yes, it's configured for my virtual domain. sudo service apache2 start after logging in still works fine to get it running.
    – eoinoc
    Commented Apr 4, 2012 at 18:24
0

You should be able to tell by tailing your system and apache logs. Usually located at /var/log/messages/ and /var/log/httpd|apache2/ respectively. Then troubleshoot using the provided messages.

3
  • /var/log/apache/ exists alright, but no logs were changed since my last boot.
    – eoinoc
    Commented Apr 4, 2012 at 18:18
  • So in your response to @maxp it sounds like the service will start. Your issue is starting at boot. Correct?
    – Josh
    Commented Apr 5, 2012 at 14:27
  • Correct - it's not starting at boot. Although I would expect it to, given the message at the beginning of my original post above...
    – eoinoc
    Commented Apr 9, 2012 at 20:39
0

Just try:

sudo update-rc.d apache2 enable
1
  • It turns out that I had an Apache configuration error as seen on another question: unix.stackexchange.com/a/45402/14091 . Do you still believe your answer would have fixed my error? Or why would "enable" work when "defaults" option didn't?
    – eoinoc
    Commented Mar 12, 2013 at 12:25

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