• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Resolved wordpress permalinks don't work with nginx

pacman94

New Pleskian
Hi, this rewrite rule doesn't work.
Code:
location / {
  try_files $uri $uri/ /index.php?$args;
}

this one works:
Code:
if (!-e $request_filename) {
rewrite ^.*$ /index.php?$args last;
}

why and what is the difference? boths are fine?
 
Hi pacman94,

actually, the ( correct / recommended! ) nginx directive:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
        }
OR
Code:
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
        }

... are the basic rewrite directives, which should work in most cases. If you desire to learn more about NGINX directives, I recommend the official NGINX documentation at:



( Pls. keep in mind, that Plesk already uses ( standart ) location directives within the ( standart ) domain specific nginx configuration files, so that additional directives might conflict with already existing location directives. A location directive can only be used ONCE, so that "if" - statements can be used to add additional directives, without conflicting with earlier settings/configurations. ;) ).
 
Hi pacman94,

actually, the ( correct / recommended! ) nginx directive:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
        }
OR
Code:
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
        }

... are the basic rewrite directives, which should work in most cases. If you desire to learn more about NGINX directives, I recommend the official NGINX documentation at:



( Pls. keep in mind, that Plesk already uses ( standart ) location directives within the ( standart ) domain specific nginx configuration files, so that additional directives might conflict with already existing location directives. A location directive can only be used ONCE, so that "if" - statements can be used to add additional directives, without conflicting with earlier settings/configurations. ;) ).

with this one can use nginx only for a site?
 
Hi Kingsley,

with this one can use nginx only for a site?
Your question is not clear enough, to be answered in general, as it depends very much on your ( unique ) content and your settings for your (sub)domain over the Plesk Control Panel.
 
Back
Top