Apache2 - file not found gets 500 Server Error instead of 404
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Apache2 - file not found gets 500 Server Error instead of 404
I am getting messages like the following:
Code:
[Mon Jan 30 09:59:57 2012] [error] [client 61.247.204.37] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Jan 30 10:00:52 2012] [error] [client 66.249.71.187] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Jan 30 10:01:32 2012] [error] [client 66.249.66.100] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
in the "/var/log/apache2/error.log" file. These are happening as the result of requests for files that are not found (and possibly for other errors, too). I can reproduce the error be requesting a file I know does not exist (and I get a "500 Server Error" instead of "404 Not Found"). So for now I will focus on why that is not giving me the proper 404 status and error message.
Originally, there was no "ErrorDocument 404" coded in my config at all. According to the Apache documentation for the ErrorDocument directive, that should result in a default action. But what I am getting is the above error messages being logged, and a "500 Server Error" to the client.
I added them in the server context as well as duplicated them in the virtualhost context for the vhost I'm performing the tests with. I still get the "500 Server Error" messages and the worthless message in the /var/log/apache2/error.log file. For now, I only want the basic simple error messages for errors.
How can I found out why Apache is doing this?
---
I added the "LogLevel debug" directive, but it's not helping. The added log messages are:
Code:
[Mon Jan 30 10:48:01 2012] [debug] core.c(3065): [client 66.249.66.215] r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /home/pub/doku.php
[Mon Jan 30 10:48:01 2012] [debug] core.c(3071): [client 66.249.66.215] redirected from r->uri = /robots.txt
Only one vhost, not one of those being tested, has Dokuwiki installed. And it's only installed in the document root for that vhost. It's not in any other vhost.
Last edited by Skaperen; 01-30-2012 at 10:01 AM.
Reason: more info from LogLevel debug
Are there any .htaccess present in the web docs directory you try to access
Not in the directory for the vhosts having this problem. There is one in the directory for the vhost using dokuwiki. It contains:
Code:
## Enable this to restrict editing to logged in users only
## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks
## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
Order allow,deny
Deny from all
Satisfy All
</Files>
## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on
#
## Not all installations will require the following line. If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
#RewriteBase /dokuwiki
#
## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
RewriteCond %{HTTPS} !=on
RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
#
RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L]
RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$ doku.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) doku.php?id=$1 [QSA,L]
RewriteRule ^index.php$ doku.php
It looks like somehow this .htaccess is being used. It should not be except for the vhost I'm testing dokuwiki in.
I uninstalled the dokuwiki package, and the problem went away. That sure seems peculiar, as none of the files supposedly installed by the package would affect Apache. There may still be some latent config or something that is now ineffective with the lack of the package. The actual web vhost I have Dokuwiki in is still working (it was installed in that site directory from Dokuwiki source, not from the Ubuntu package "dokuwiki" that I just uninstalled).
---
I'm still wanting to know what caused this, but it's apparently devolved to an indeterminate case, now.
Last edited by Skaperen; 01-30-2012 at 11:18 AM.
Reason: added part 2
If that is the case, then your Vhost for "dokuwiki" was misconfigured.
Since the "httpd.conf" is not shown here, it's hard to say what was it.
Probably, because of misconfiguration, the Apache took the "dokuwiki" settings for all http server hosts and since .htaccess was there also the errors 500 arise.
Ultimately, the httpd.conf was not changed at all. I removed those additions I made earlier, as they have no effect. With the dokuwiki package not installed, everything works fine, now ... even the site I have dokuwiki running in (installed from source from the dokuwiki download site, and copied into this vhost's document root directory, and configured per dokuwiki instructions).
I didn't paste it because it is huge. If it would have been necessary, I could (but redacting the 1178 domain names would have been a bit of a chore). That number will be growing later when I start to deploy wikis.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.