Apache starts automatically on Ubuntu, needs to be stopped to restart lighttpd

apache-2.2lighttpdubuntu-9.04

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?

Best Answer

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 ...
/etc/rc0.d/K09apache2
/etc/rc1.d/K09apache2
/etc/rc2.d/S91apache2
/etc/rc3.d/S91apache2
/etc/rc4.d/S91apache2
/etc/rc5.d/S91apache2
/etc/rc6.d/K09apache2

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.

Related Topic