skip to Main Content

I’m running into an extremely bizarre error while running a WordPress site.

WordPress has permalinks turned on. The 500 server error occurs when you REMOVE the trailing slash (/) from the URL. For example:
www.site.com/about/ -> works fine.
www.site.com/about -> throws a 500 server error.

The error log show the following:

[Tue Sep 24 00:44:58 2013] [warn] [client 75.52.190.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Sep 24 00:44:58 2013] [error] [client 75.52.190.1] Premature end of script headers: index.php

WordPress debug log is active, but no errors or warnings are being generated.

Other points to note:

  • The server has multiple domains managed under Plesk 11.5.
  • Only one of the domains suffers from this issue.

I compared the config vhost.conf files located in /var/www/system/domain/etc/ to another wordpress domain that is not having this issue. Everything is identical.

I also tried removing all of the wordpress files and uploaded a completely fresh copy. The problem still occurs, even with a fresh copy of WordPress and no plugins, templates, or anything else.

One last item that I noticed. My domain specific vhost.conf has the following info:

location ~ /$ {
 index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
 try_files $uri $uri/ /index.php?$args;
}

That seems to be looking for anything with a /. Should I remove the / or add a similar block? The only reason I haven’t tried is because none of the domains suffer from this issue. My next course of action would be to download all domain conf files and diff them against the domain with the error. I’d rather not go down that path if possible.

Thanks!

3

Answers


  1. Chosen as BEST ANSWER

    The final, working code for me is as follows:

    location ~ / {
       index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
       try_files $uri $uri/ /index.php?$args;
    }
    

  2. You need to remove the $ from the location block, because this location only matches URL’s that end with a /, and since you won’t need regex then you can remove ~ too, so the final result is

    location / {
        # your rewrites and try_files
    }
    
    Login or Signup to reply.
  3. Strange, without

    location ~ /$ {
        try_files $uri /wordpress/index.php?$args;
    }
    

    I’ve got 404 error for permalinks. And with it everything working. Maybe it will helps someone.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search