0

I build my own server on EC2 this weekend, everything goes well and my server is running, at least for a while, until shutdown.

First of all, I'm starting the server with sudo service apache2 status and everything is perfect, my server starts and I am able to navigate around my webpage.

Then, suddenly the server stops running (the EC2 instance works perfect) when I do sudo service apache2 status

I get this output:

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Tue 2019-07-16 01:28:00 UTC; 54min ago
  Process: 18543 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 18565 (code=exited, status=1/FAILURE)

Jul 15 21:17:38 ip-172-31-9-236 systemd[1]: Starting The Apache HTTP Server...
Jul 15 21:17:38 ip-172-31-9-236 systemd[1]: Started The Apache HTTP Server.
Jul 16 01:28:00 ip-172-31-9-236 systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE
Jul 16 01:28:00 ip-172-31-9-236 systemd[1]: apache2.service: Failed with result 'exit-code'.

And I really don't know why.

I'm using EC2 from amazon with a route53 and https from cerbot. The /var/log/apache2/error.log output is nothing.

  • Try running `journalctl -xe` to see if there is any log information. – mchid Jul 16 '19 at 04:09
  • Actually, you may have better luck with `journalctl -xe | grep apache` see here: https://askubuntu.com/questions/629995/apache-not-able-to-restart however, if you decide to reinstall or purge apache2, don't forge to backup your files first! Also, you can try starting with `sudo systemctl start apache2` or `sudo systemctl restart apache2` Additionally, please post a comment to let us know if that answer works for you or not so that we can mark this as a duplicate or try to figure something else out. Thanks! – mchid Jul 16 '19 at 04:22
  • of course I restart the server again and again, The problem is that I do not know why it's being turned off – Julian Mendez Jul 16 '19 at 12:15
  • Did you check `journalctl -xe` for some additional information? Systemd may have errors that are not reported in `/var/log/apache2/error.log`. – mchid Jul 17 '19 at 06:50
  • yes I did. At `/var/log/apache2/error.log.1` says something about mutex and I guess I fix it uncommenting a line in the `/etc/lib/apache2/apache2.conf` – Julian Mendez Jul 17 '19 at 14:24
  • If you have errors, please post them. If you found a solution to your issue, you can answer your own question. You can also mark your answer as the accepted solution after the answer has been posted for a couple of days. – mchid Jul 17 '19 at 19:41

1 Answers1

1

Finally I found the solution my self.

When I did cat /var/log/apache2/error.log.1 I found this failure Identifier removed: AH00144: couldn't grab the accept mutex.

After a bit of research I found this line from /etc/apache2/apache2.conf #Mutex file:${APACHE_LOCK_DIR} default. I DID NOT UNCOMMENTED but add this Mutex posixsem after that line.