I just restarted Apache and now the server is down

apache-2.2

I am pretty terrified right now. I'm scared I'm going to get a call in a couple minutes from a hundred people saying the website doesn't work.

I was at the terminal changing some configuration files when I went to restart the server to update the .conf files with this command:

/etc/init.d/apache2 graceful

After I ran that, none of the websites work and I have no idea what to do.

There are about 100 errors I am getting according to the log files. They all begin with "PHP Notice" and most relate to "use of undefined constant" Also, I just spoke with a coworker, describing what I did, and he noticed that there are two installations of apache on the server and that I restarted the one that we don't use.

This is what the error log says (assuming it's the correct error log):

[Wed Jan 05 11:52:06 2011] [notice] Graceful restart requested, doing restart
Warning: DocumentRoot [/u/apps/staging/antetr/current/public/] does not exist
[Wed Jan 05 11:52:08 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs
(2)No such file or directory: apache2: could not open error log file /u/apps/production/madfilmdash/current/log/apache-error.log.
Unable to open logs

FINAL UPDATE:

Ok, I fixed it. The problem was (as you experts facepalming probably know) that it couldn't access an error log in the directory I was working in. I created an empty error log file and tried the restart command again and now all the sites are back up… Though my original problem is still there..

Thanks to all those who offered advice, it really helped and let me breathe for a moment.

Best Answer

your apache log files location varies by system. from cyberciti.biz:

  • RHEL / Red Hat / CentOS / Fedora Linux Apache error file location - /var/log/httpd/error_log
  • Debian / Ubuntu Linux Apache error log file location - /var/log/apache2/error.log
  • FreeBSD Apache error log file location - /var/log/httpd-error.log

In the future, either make a backup of your .conf file before editing it, named with the datestamp of the change so that worst come to this, you can recover to a previous version OR, only comment out changed lines and add comments to new lines so you can keep track of what changed when and why. editing without a way to go back is one guaranteed way to attract bad mojo.