10

We have recently gotten a backup server to mirror all our data onto in case the primary server goes down.

I've gotten all the sites data updated through rsync, and all the apache config and databases updated. Both machines are on Ubuntu 9 (9.04 on the primary, 9.10 on the backup).

So everything seems synced up for the most part at this point (still need to figure out user syncing), and I try to start Apache. I get

* Starting web server apache2                                       [fail]

Nothing else indicating what the problem could be.

I know I don't have enough info to expect a solution from you guys, so I'd just like to know where I can go from here to further investigate this issue. Would there be any error logs for this?

Thanks!

Lowgain
  • 237
  • 1
  • 2
  • 7

5 Answers5

18

httpd -t will test the syntax of your configuration files and spit out any errors to the terminal.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
14

In some specific cases, a log entry will not be written to disk -- this can occur if logs don't exist, for example, or Apache simply cannot write to the log files due to permissions issues, etc. In such cases, the best way to diagnose an error is to use `strace':

[root@server ~]# strace -Ff apachectl start

While the output will be quite verbose, if Apache fails to start for any reason, you'll see a write() at the tail end with the contents of what would be entered in the logs with the reason it's failing (if it's not logging why in the error log, don't be surprised if the error message contains "Cannot open log" with the path to the log ;).

Though looking at your comment regarding mod_fcgid, I'd suggest reviewing the Apache configuration and examining references to mod_fcgid -- it sounds like it's trying to open a literal "mod_fcgid" file as opposed to loading the module.

slm
  • 7,355
  • 16
  • 54
  • 72
3

Any errors should be printed to the error logs (often at /var/log/http/error_logs. Grep for ErrorLog in your httpd.conf to find out where.

I recommend using two windows. Do a 'tail -f error_log' in one window, and use another window to run the 'apachectl restart' command. After you find the error, update your answer here with the error message.

Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184
  • The number one troubleshooting step in anything should always be read the logs. Apache logs nearly every single event that passes through it, so you should be chock-full of data to peruse. – phuzion Jun 12 '10 at 18:41
3

I had similar problem with debug apache server on Mac OS, so decided to share my experience and save others some time I found the following very helpful:

  1. locate logs:

apachectl -S | grep log

  1. in the output you will find some logs files you can start look for the errors example:

tail -n 15 /var/log/apache2/ssl_engine.log

In case there are more than 1 log file continue tailing them until you find the error causing apache to not start

talsibony
  • 143
  • 1
  • 6
  • None of these steps work, because the apachectl -S | grep log is not even a valid code – user664905 May 10 '21 at 11:30
  • @user664905 apachectl -S | grep log works for me on mac os, I assume if it not runs on your command line this might be your problem, try ps aux | grep httpd to see what process of apache are running, telnet localhost 80 – talsibony May 11 '21 at 15:05
-1

If your Apache isn't running, check your skype port, most of the time both skype and apache use port 80, and that means skype might be the reason why apache can't start. stop skype if it is installed.