1

I have fresh Ubuntu 14.04 installation with apache2. I have noticed apache2 is not starting at the boot. I have tried to enable it with sudo update-rc.d apache2 defaults, but it still doesn't start with the system...

Restarting using services sudo service apache2 start works ok.

I have checked the apache2 log less /var/log/apache2/error.log, but it seems the system doesn't start it at the boot. Any idea how to enable autostart?

HINT: My home folder is encrypted, while some websites DocumentRoot are stored in my ~/Public folder. Thus, apache2 probably cannot start, because some encrypted folders are not mounted at boot. Is there a way of starting apache2 on login, or postponing its launch until my home filesystem is mounted?

2 Answers 2

0

You can postpone apache to start by renaming the symlinks which were created byupdate-rc.d apache2 defaults - "defaults" mean that such symlinks were created for default runlevels set in /etc/init.d/apache2, so in /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, /etc/rc5.d directories..

In each above directory, you will see something like "S91apache2 -> ../init.d/apache2*" issue command sudo mv S91apache2 S99apache2 in each above directory.

The biggest is the number, the later the script will be started - however, using S99 is the latest posssible time to start...

4
  • that's useful. and what does S91 or S99 mean? how can I check when is the encrypted filesystem mounted?
    – Leszek
    Jan 17, 2015 at 12:28
  • regarding S91 and S99 have a look at the UpstartHowto here: help.ubuntu.com/community/…
    – aFoP
    Jan 17, 2015 at 12:35
  • 1
    I'm afraid your encrypted /home directory will be only mounted after you log on...
    – aFoP
    Jan 17, 2015 at 12:52
  • indeed, that's the case. then my next question, can apache start with some virtual hosts, and enable virtual host from my encrypted home after I login?
    – Leszek
    Jan 19, 2015 at 8:30
0

With heavy adoption of systemd as system manager and init system for debian based distributions like ubuntu , we can now use systemctl commands to enable a service to start when booting

for example :

sudo systemctl enable apache2

You must log in to answer this question.

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