1/30/2016 Problem Restarting Apache2: Solutions

If you're using apache 2 as webserver maybe sometimes you'll have to deal with common problems like vhost, syntax errors,  bad configurations. Sometimes is when you edit a file inside  /etc/apache2/sites-enabled/file.conf and maybe your edition just didn't accomplish with the syntax so here  is how can you check :

1. Make sure that your Apache2 service is up and running.
user@~$sudo service apache2 status 
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
   Active: active (running) since Fri 2016-01-29 14:05:16 EST; 14s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 31573 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 17063 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 30948 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS) 
  ... 

If this isn't the output, read carefully the error.
2. Check your systemctl status, this will give you a lot of information.
user@~$sudo systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2016-01-29 13:48:57 EST; 18s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 31573 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 17063 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 30467 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
3. Run the apache config test. It is always a good idea to run configtest everytime you make changes to the apache2 config file so that you won't accidentally stop apache2 service
user@~$ sudo apache2ctl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
4. Restart the apache service
user@~$ sudo service apache2 stop && sudo service apache2 start

References:

[1]http://www.techrepublic.com/article/troubleshoot-apache-problems-with-these-tips/
[2]https://www.digitalocean.com/community/tutorials/how-to-troubleshoot-common-site-issues-on-a-linux-server
[3]https://www.linode.com/docs/troubleshooting/troubleshooting-common-apache-issues
Digg it StumbleUpon del.icio.us

0 comentarios:

Post a Comment