Nginx :: Curvve Media Blog

Fixing Plesk 11.5 error 500 NGINX & WordPress path url slash redirect error

Posted by | Servers | No Comments

You may have noticed that when visiting a WordPress site on a Plesk 11.5 server, the page redirects don’t always work. Depending on whether or not the URL has a trailing slash (/), you may get a 500 Internal Server Error message. 

The problem seems to be with the default templates that Plesk uses to create domains. Luckily, we can customize them and fix the issue in the URL rewrite lines. 

Create a custom NGINX Default Domain template

First, we need to create the custom paths and copy the original template files. 

mkdir /usr/local/psa/admin/conf/templates/custom/domain
cd /usr/local/psa/admin/conf/templates/custom/domain
cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php .

Edit our NGINX Default Domain VirtualHost PHP template

Now we edit the NGINX Default Domain VirtualHost PHP template and make some minor changes to the URL rewrite

nano nginxDomainVirtualHost.php

Find / Replace this block of code:

location ~ /$ {
    < ?php echo $VAR->domain->physicalHosting->proxySettings['directoryIndex'] ?>

With this:

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

Rebuild your domain configurations

Now we tell Plesk to rebuild the NGINX conf files for the domains on the server

/usr/local/psa/admin/bin/httpdmng --reconfigure-all

Restart Apache, NGINX and PHP-FPM

service php-fpm restart
service nginx restart
service httpd restart


Contact Us

Have a question? Send us a message. We'll get back to you soon.