22 hours ago
I installed apache as follows on my Ubuntu 16.04 machine:
$ sudo apt-get update $ sudo apt-get install apache2
It served my test pages fine. Now I tested a reboot of the machine, and I can't reach the server. I try:
$ service apache2 status
and get:
â apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d ââapache2-systemd.conf Active: inactive (dead) since Tue 2016-08-16 20:13:45 UTC; 6min ago Docs: man:systemd-sysv-generator(8) Process: 1111 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 2624 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
How can I get apache to restart on reboot?
-- Edit -------------------------------------------------------
As per @mouseclone's suggestion, I ran:
sudo systemctl enable apache2.service
output:
apache2.service is not a native service, redirecting to systemd-sysv-install Executing /lib/systemd/systemd-sysv-install enable apache2
still no change though, reboot and then apache is down.
5 hours ago
Ubuntu 16.04 uses systemd.
General instructions: https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal
sudo systemctl enable nginx.service
8 hours ago
Strange.. though you could add @reboot service apache2 start to crontab to start apache2 service on boot. You can access crontab using crontab -e command
@reboot service apache2 start
crontab -e