Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I can't reload apache2 on Ubuntu?

On Ubuntu, each time I use sudo service apache2 reload command to reload apache2 service , my terminal showed

apache2.service is not active, cannot reload.     

And, I'm trying to add phpMyAdmin as virtual host, using phpmyadmin.local as local-area-network domain name; can anyone tell me how? I have tried many times today, I searched many methods, but until now, it's still 404 not found.

like image 255
nick Avatar asked May 26 '16 15:05

nick


1 Answers

I had the same problem with Ubuntu 16.04. This was causing problems with logrotate, because it could not reload Apache after rotating logs.

The full error I was getting:

/etc/init.d/apache2 reload
[....] Reloading apache2 configuration (via systemctl):    apache2.serviceapache2.service is not active, cannot reload.
 failed!

The problem went away after stopping Apache with apachectl and starting it with /etc/init.d/apache2:

apachectl stop
/etc/init.d/apache2 start

You can now reload Apache:

/etc/init.d/apache2 reload
[ ok ] Reloading apache2 configuration (via systemctl): apache2.service.

If you start Apache with apachectl start, it is not being marked as an active service, so you can't reload it with service apache2 reload. You have to start Apache with /etc/init.d/apache2 start or service apache2 start.

I'm not sure if it's intended or a bug. I can't reproduce this with an older system.

like image 75
Paulius Jacionis Avatar answered Sep 18 '22 06:09

Paulius Jacionis