• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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