1

I'm trying to setup a site with static HTML with Apache 2.2.22, but I'm getting a 500 error instead of 404.

The message in the error log is:

[Sun Dec 14 09:48:45 2014] [error] 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.

When I set LogLevel to debug I see

[Sun Dec 14 09:48:45 2014] [debug] core.c(3112): r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php
[Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /norealfile
[Sun Dec 14 09:48:45 2014] [debug] mod_deflate.c(700): Zlib: Compressed 538 to 325 : URL /home/nxad/index.php

My site has no PHP and the Apache configuration file doesn't use mod_rewrite:

ServerName nxfifteen.me.uk

RewriteEngine off

ErrorDocument 404 "Missing File"

LogLevel debug
ErrorLog /home/nxad/logs/error_log
TransferLog /home/nxad/logs/access_log

DocumentRoot /home/nxad/public_html/

DirectoryIndex index.html
<Directory /home/nxad/public_html>
   Options -Indexes +IncludesNOEXEC FollowSymLinks
   AllowOverride None
   allow from all
</Directory>

I've searched every file within the Apache configuration folder as well as the public_html folder and there are no references to /home/nxad/index.php (or any other files underneath the DocumentRoot) and no .htaccess files.

Lorenz Meyer
  • 430
  • 2
  • 9
  • 25
  • You've searched the config files for references to /home/nxad/index.php - what about just "index.php"? Or even just "php"? – Paul Haldane Dec 14 '14 at 11:33
  • Would it be worth enabling mod_info and seeing what Apache's idea of the config is? That redirection has to be coming from somewhere. – Paul Haldane Dec 14 '14 at 11:35
  • Can you try this? grep -R php /etc/apache2 and this grep -R DirectoryIndex /etc/apache2 – risyasin Dec 14 '14 at 11:55
  • @PaulHaldane - There are no references to index.php or php in my DocumentRoot and the only mention of it in /etc/apache2 was DirectoryIndex for other VirtualHosts. I also tried enabling mod_info but it didn't have anything unexpected, which didn't match the /etc/apache2 – Stuart McCulloch Anderson Dec 14 '14 at 14:19
  • @risyasin the only mention of php within /etc/apache2 is for DirectoryIndex on other sites and the /etc/apache2/modes-enabled/php5.conf – Stuart McCulloch Anderson Dec 14 '14 at 14:22
  • I've stripped the server right back, and taking all other sites offline in the process, disabling all mods then re-adding them one by one. As soon as I disable mod_rewrite sites start returning 404 errors again, until I re-enable it. I've looked in mods-enabled/rewrite.load but all it has is LoadModule there is nothing else that could be setting up any rewrite – Stuart McCulloch Anderson Dec 14 '14 at 14:25

1 Answers1

2

After following all of the suggestions above I looked at all the other sites hosted on the same server and found the problem was replicated across all the sites housed under my home directory, but not on any others.

After that I ran find ~/ -type f -name ".htaccess" instead of just in my DocumentRoot (/home/nxad/public_html) directory and found a .htaccess file inside the home directory (/home/nxad) as soon as I deleted the problem resolved its self.

I have since found this Apache HTTP Server Tutorial: .htaccess files which confirms that Apache will look for .htaccess files in all higher-level directories