>> service apache2 reloadHowever, I also found that there's no apparent way to read the log which may tell why "apache2 failed" (no error in apache log as well). So, I used strace
Reloading web server config: apache2 failed!
strace -Ff service apache2 reload &> /tmp/tThen by search "log" keyword in /tmp/t, we can get:
Process 62754 detachedYes, here is it! It's saying that "configtest" is failed which is causing "apache failed".
[pid 62750] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 62754
[pid 62750] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 62750] rt_sigreturn(0x11) = 62754
[pid 62750] write(1, "Action 'configtest' failed.\n", 28) = 28
[pid 62750] write(1, "The Apache error log may have mo"..., 48) = 48
[pid 62750] exit_group(1) = ?
So, here's comes a better way to debug my config file:
>> apachectl configtest
apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Syntax error on line 26 of /etc/apache2/sites-enabled/nphw3.conf: use of macro 'VHost' defined on line 2 of /etc/apache2/sites-enabled/nphw3.conf with 2 arguments instead of 3
Action 'configtest' failed.
The Apache error log may have more information.
No comments:
Post a Comment