Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've some issues with my webserver's Apache and lighttpd on Ubuntu 9.04.

I use lighttpd only and I've stopped Apache on Ubuntu. For some reason, starting a few days ago, Apache starts to run and I need to stop it in order to restart lighttpd.

Cron has nothing about this. And this issue started to exist just last week. What could be the reason?

How can I disable Apache?

share|improve this question
Why have Apache installed if you don't use it ? – Shadok Mar 22 '11 at 11:17
Are you the only user on this server? Could someone else (intruder or other admin) be starting apache? – MattBianco Mar 22 '11 at 12:11
up vote 9 down vote accepted

Ubuntu has an init system for starting various services on boot, depending on the runlevel that is booted into. Apache by default adds itself to the various /etc/rc*.d/ when you install it through apt, so it gets started by default for most runlevels.

To remove the startup links to the init script for apache2, you'll want to run something like:

 update-rc.d apache2 disable

This should give you an output like:

Disabling system startup links for /etc/init.d/apache2 ...
Removing any system startup links for /etc/init.d/apache2 ...

And now apache won't start on boot. You can still start it manually using the script in /etc/init.d:

/etc/init.d/apache2 start

To see what services are currently enabled for boot-time startup, you can use a tool like chkconfig, which I don't believe is installed by default but is available in the repositories.

edit: if you don't want apache running at all, you might be better off just uninstalling it.

share|improve this answer
I'm actually not rebooting the server. It just starts without rebooting. – Patrick Mar 22 '11 at 11:08
Ok, that's more curious. I would double-check cron, and make sure to look in both the root crontab as well as the various cron.* directories inside /etc/. If nothing's there, dig into the logs - when I restart apache I get a notice in /var/log/apache2/errors.log stating '[notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.7 with Suhosin-Patch configured -- resuming normal operations'. Dig through syslog as well to see if there's anything weird going on there as well. – growse Mar 22 '11 at 11:18
-1: Ubuntu uses upstart - although it does also support sysV init scripts, the symptoms clearly point to something other than a sysV init managing the process. - see also – symcbean Mar 22 '11 at 12:35
I was under the impression that Ubuntu uses upstart for some/most things, but on the system I have in front of me, not Apache2. it's not listed in initctl list and still has a script in /etc/init.d, rather than a symlink to /lib/init/upstart-job. – growse Mar 22 '11 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.