masterblaster Posted November 27, 2015 Share Posted November 27, 2015 Hello, I recently switched some customer domains from php-cgi (apache served) to php-fpm (nginx served with apache as reverse proxy using the plesk-php56 package). I use a plesk panel on the server that uses apache as a reverse proxy if the requests are served by nginx. Everything went flawlessly and I had a great boost of performance - but I have an issue with url rewriting that is driving me crazy. If the domain is configured to have multiple languages the starting URL would be something like : http://www.website.com/en/ http://www.website.com/fr/ http://www.website.com/it/ In this condition Nginx returns a 404 not found error when opening the page. Of course with an apache-only configuration the url opens correctly and returns the homepage. I can confirm that even with php-fpm, the native apache prestashop rewrite rules in ".htaccess" are working properly once the web request arrive to apache (because of the reverse proxy configuration)... but this particular request seems to be processed by nginx directly ... The problems seems to be the trailing slash, in fact if I type the URL with "/en" - the site opens correctly. It looks like nginx search for index file, not being able to find it. Those are the solution I tried without success : 1 - Using an .htaccess to nginx converter and apply the rule (same problem) 2 - Using a nginx rewrite rule ( rewrite ^/(.*)/$ /$1 permanent; ) in nginx.conf file to force redirecting slash requests to non-slash requests but this lead me to other redirection-loop url troubles. any idea for a proper configuration ? Link to comment Share on other sites More sharing options...
dusticelli Posted February 21, 2016 Share Posted February 21, 2016 Hi, this is a while ago, but I am coming to the same problem. Did you find a soloution for hat in the meantime? regards dusticelli Link to comment Share on other sites More sharing options...
dusticelli Posted March 23, 2016 Share Posted March 23, 2016 Hi mdekler, sorry for not respnding again. I am on Gmail and whatever I do, or the support gives as a soloution many of my forum mails fall in the spam folder. So sometimes I miss that I have got response to a posting. Now by luck because I am still/again struggling with a nginx presta config problem I came back here over google. Actually my shops seems to work quite ok, with only 2 exceptions: - Customer can not logg out - Compare list is empty after calling the compare site This happens only with activated SEO-Urls & Multilingual Shop. If one of these parameters is turned to "off" the problem is solved. My Server is Nginx 1.8 and the config file I have attached containes only the snippet from the Prestashop documentation location / { index /index.php; rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last; rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last; rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1.jpg last; rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; try_files $uri $uri/ /index.php?$args; } Nothing more. Link to comment Share on other sites More sharing options...
Italian HUB Posted July 18, 2021 Share Posted July 18, 2021 We have the same problem today with prestashop 1.7 and nginx. Link to comment Share on other sites More sharing options...
Preskaribou Posted November 16, 2023 Share Posted November 16, 2023 news ? Link to comment Share on other sites More sharing options...
TimmeHosting Posted November 17, 2023 Share Posted November 17, 2023 Hey Preskaribou, do you have the same problem? Maybe we can help you. We just need to know, which nginx- and prestashop-version you are using and a description of your setup. Your complete Config would also be very helpful. Link to comment Share on other sites More sharing options...
nqo Posted January 10 Share Posted January 10 On 11/17/2023 at 5:31 AM, Preskaribou said: news ? Hi all I resolved this issue by adding a rewrite rule to my server's main nginx conf file. This code snippet goes inside the <code> server { } </code> brackets. # Web service API. rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; I edited the .conf file by SFTP-ing into my server. You can also edit it by command line. Next I re-started nginx. systemctl reload nginx Now my webservice is running. I hope this helps someone else! Link to comment Share on other sites More sharing options...
Butch0071 Posted June 6 Share Posted June 6 On 1/10/2024 at 8:32 AM, nqo said: Hi all I resolved this issue by adding a rewrite rule to my server's main nginx conf file. This code snippet goes inside the <code> server { } </code> brackets. # Web service API. rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; I edited the .conf file by SFTP-ing into my server. You can also edit it by command line. Next I re-started nginx. systemctl reload nginx Now my webservice is running. I hope this helps someone else! I did like this but still have 404 error when redirecting on multilanguiage Presta 8.04 on PLESK with php-fpm served by enginx. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now