5

I tried using this sudo /etc/init.d/apache2 stop, but it only temporarily works and the server starts working again after a reboot. Is there a disable feature or something similar?

1
  • Upvote for being the #1 response from Google I searched on raspbian disable apache2 (June 2018).
    – SDsolar
    Commented Jun 6, 2018 at 20:31

1 Answer 1

7

To stop a service doesn't prevent the deamon to start the service on boot. For this you should deactivate the service to come up on all run levels

A simple command for this on raspbian is update-rc.d apache2 disable If you later want the webserver starts again on default just type update-rc.d apache2 enable'

With the comand sudo /etc/init.d/apache2 start you bring up the web server on demand.

3
  • Upvote. If the Pi is busy and should not be rebooted, the service can be stopped immediately with sudo service apache2 stop
    – SDsolar
    Commented Jun 6, 2018 at 20:56
  • @SDsolar, great addition! If thats fail, last option could kill the process. But this should not the way stopping a process. Commented Jun 7, 2018 at 13:22
  • I just used your sudo update-rc.d apache2 disable on several of my Pi3 data loggers that are in operation 24x7. They had apache2 because I had enabled it on the first one before I began cloning them. I don't reboot them unless necessary. They produce what ultimately gets out on the web at SDsolarBlog.com/montage - among their other duties. So I followed your procedure then stopped the service. All finished now, and prepared for the next eventual reboot. Thank you much for this tip.
    – SDsolar
    Commented Jun 7, 2018 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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