Need helpful error message from mod_proxy_fcgi – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, php, apache-2.4, , .
When a non-existent php script is requested, mod_proxy_fcgi provides a rather useless error message, basically just saying
[proxy_fcgi:error] .... AH01071: Got error 'Primary script unknownn'
This server is using Apache 2.4.6 (Centos 7), with php handling configured as:
<FilesMatch .php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
I really would like to know the actual script name, because it may contain useful information (such as indicating a defective link, an error in a page name, or merely showing that it is just another fool hunting for a server with unprotected wp-login.php).
I tried changing LogLevel from info to debug, but then the error log was also filled with valid php script access details, which makes quite a mess of the error log, since those are not actually errors.
Is there some way to get a more useful proxy_fcgi error message which includes the actual script name for non-existent php scripts?
You can define ErrorLogFormat including the %L
and then do the same in your CustomLog format %L
That will make Apache log a specific id which will bind an errorlog entry into the access log entry and then all you need to do is grep.
Example:
ErrorLogFormat "[%{u}t] [%-m:%l] [%L] [pid %P:tid %T] %7F: %E: [client %a] %M% , referer %{Referer}i"
LogFormat "%h %l %u [%L] %t "%r"" %>
s ""%{Referer}i"" ""%{User-Agent}i"""" combined