Enabling Apache does not stick

I have been running Apache as a local server for some time now. I know a fair amount about Apache since I run several web sites online with it (using Debian).

Every time I reboot Manjaro I have to restart Apache by hand. I have tried the usual…
sudo systemctl enable httpd
sudo systemctl start httpd

Obviously the Enable does not stick. Is there something I’m missing here, please?

Hi @dstiles,

Please provide the output for:

sudo systemctl status httpd

And

sudo systemctl enable --now httpd

It might be that the directory it’s configured to serve isn’t available yet. So double-check that.

Whoops, there goes my good idea for the day.

I installed it and it works as expected after reboot when service is enabled.

I would check the configs - if a service don’t start it’s usually configuration related and you would get a hint using the status command of systemctl.

It could also be permission related - the http user cannot read the files.


● httpd.service - Apache Web Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor pre>
     Active: active (running) since Tue 2022-02-08 10:16:50 GMT; 3h 1min ago
   Main PID: 17659 (httpd)
      Tasks: 7 (limit: 16699)
     Memory: 26.1M
        CPU: 1.112s
     CGroup: /system.slice/httpd.service
             ├─17659 /usr/bin/httpd -k start -DFOREGROUND
             ├─17661 /usr/bin/httpd -k start -DFOREGROUND
             ├─17662 /usr/bin/httpd -k start -DFOREGROUND
             ├─17663 /usr/bin/httpd -k start -DFOREGROUND
             ├─17664 /usr/bin/httpd -k start -DFOREGROUND
             ├─17665 /usr/bin/httpd -k start -DFOREGROUND
             └─18887 /usr/bin/httpd -k start -DFOREGROUND

Feb 08 10:16:50 cronus systemd[1]: Started Apache Web Server.

systemctl enable --now httpd

No output.

linux-aarhus
I would check the configs - if a service don’t start it’s usually configuration related and you would get a hint using the status command of systemctl.
It could also be permission related - the http user cannot read the files.

Apache starts fine when I use systemctl start httpd and I can detect no config problem - the local site works fine once started. I suppose it may be trying to start Apache too soon, before everything else is settled and working, but there is no problem on the Debian or Ubuntu servers - they just start straight after reboot.

Does it create the required symlink when you enable the service? If it doesn’t, here is your problem (still would need to find out why, but it should output the symlink creation when enabling the service).

systemctl disable httpd
systemctl enable httpd

1 Like

Does it create the required symlink when you enable the service? If it doesn’t, here is your problem (still would need to find out why, but it should output the symlink creation when enabling the service).

Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

Then what is the service status right at boot, without manual intervention? Reboot and check, and report here.

systemctl status httpd

Thanks for the idea. It may be a few days before I can reboot, though. It takes around half an hour to set everything up afterwards so I am reluctant to do so until necessary.