• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Nginx Rewrite issue

Søren

New Pleskian
TITLE:
Nginx Rewrite issue
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Plesk Onyx
PROBLEM DESCRIPTION:
I was trying to use my typical rewrights for prestashop, but somehow there is an issue setting it.

Some of the vars are removed from the string and that makes it fail.

rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

It removes $1 and $2​
STEPS TO REPRODUCE:
Try and enter

rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

To the nginx config area.​
ACTUAL RESULT:
Removes needed vars​
EXPECTED RESULT:
Expected result is it saves rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

Since it works with nginx.​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Help with sorting out
 
Hello @Søren .

I have just tried to add the rewrite directive in nginx additional directives and I haven't notice this issue.
And why do you not use the directive try_files instead of rewrite ? (I do not find your configuration exemple in prestashop documentation).
 
TITLE:
Nginx Rewrite issue
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Plesk Onyx
PROBLEM DESCRIPTION:
I was trying to use my typical rewrights for prestashop, but somehow there is an issue setting it.

Some of the vars are removed from the string and that makes it fail.

rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

It removes $1 and $2​
STEPS TO REPRODUCE:
Try and enter

rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

To the nginx config area.​
ACTUAL RESULT:
Removes needed vars​
EXPECTED RESULT:
Expected result is it saves rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;

Since it works with nginx.​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Help with sorting out

@Soren,

I am pretty sure that your regexp is the root cause of the problem.

Nevertheless, you should never use a rewrite like this.

In essence, @virtubox is right and you can (which is not equivalent to "should") use the try_files directive.

In that directive, one certainly does not want to specify the full and problematic url: one should pass the (Nginx default) $request_uri variable.

In general, I would recommend to change the whole line of Nginx code.

After all, the current line is more or less saying: when matched with directory modules (or any of it's subdirectories), go to index.php and pass the request parameters.

Can you provide us with a full example of a full request_uri (as specificied by Prestashop) AND a full request URL (as beautified by your current Nginx config)?

Regards...........
 
Back
Top