• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Resolved Nginx config for WordPress rewrite rules

Gabor H

Basic Pleskian
Hi,

How to configure Nginx, to make it work properly with WordPress rewrite rules correctly?

I've this in a domain's additional nginx directives:

if (!-e $request_filename) { rewrite ^.*$ /index.php last; }


But sometimes nginx struggling with the rewrite rules, I guess, because some pages are broken.
Pls help me to find the best nginx config for rewrite.

G.
 
Hi Gabor H,

Wordpress itself offers a guide with some standard configurations: => https://codex.wordpress.org/Nginx
Pls. note, that almost all issues with "broken" links are based on the fact, that when you use apache2 AND nginx, unique ".htaccess" - definitions are not correctly converted into nginx directives. Often enough, additional plugins require rewrites which are automatically added into the ".htaccess" - files, but the webmaster forgot that he/she uses niginx as well and the needed nginx directive is missing. :(

Plesk offers as well a wonderfull tool called "htaccess to nginx" - converter. You find this extension at the "Extension catalog" ( "Home > Extensions Management > Extensions Catalog" ), or at => htaccess to nginx at ext.plesk.com
 
Hi UFHH01,

Thanks for your reply.
I've finally sorted out the issues.

But, some broken pages are still exist.
Which is unfortunately an off-topic related issue.
A WP theme cookie(s) has long, or longer than needed validation time.
(some pages only loading in right order, when browser's cache+cookie deleted)

Is there any solution maybe, or do you know a solution maybe to control cookies invalidation via
Nginx?


Regards,
Gabor


Hi Gabor H,

Wordpress itself offers a guide with some standard configurations: => https://codex.wordpress.org/Nginx
Pls. note, that almost all issues with "broken" links are based on the fact, that when you use apache2 AND nginx, unique ".htaccess" - definitions are not correctly converted into nginx directives. Often enough, additional plugins require rewrites which are automatically added into the ".htaccess" - files, but the webmaster forgot that he/she uses niginx as well and the needed nginx directive is missing. :(

Plesk offers as well a wonderfull tool called "htaccess to nginx" - converter. You find this extension at the "Extension catalog" ( "Home > Extensions Management > Extensions Catalog" ), or at => htaccess to nginx at ext.plesk.com
 
This one below works best for me with nginx. Put it in Apache & nginx Settings -- Additional nginx directives

if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
 
Back
Top