Castris Posted May 21, 2019 Share Posted May 21, 2019 (edited) More than 12 hours looking for the solution to have a multi-language store, in a Plesk Odin environment, based on Nginx server (without apache) + FPM Dozens of posts in google, and no solution. On my stage, and in order not to disturb my client, who insists (I do not know why) on using a Plesk control panel, I created in a VPS development, a fresh installation of Plesk, with a prestashop 1.7.5.2 Once installed and tested, it worked perfectly in Apache mode, without using nginx Activation of Nginx (Apache deactivation) It works as long as there are no languages. If there're languages all links show The page you are looking for was not found. 2.137.128.33 - - [21/May/2019:11:34:52 +0200] "GET /en/women/2-9-brown-bear-printed-sweater.html HTTP/1.1" 404 6876 "http://tamainut.info/en/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95" I use a official nginx.conf.dist with adaptations to Plesk interface, beacuase Plesk is a intrusive panel. This use a nginx.conf with call to vhost_nginx.conf (content below) index index.php; # Redirect 404 errors to prestashop error_page 404 /index.php?controller=404; # Gzip Settings, convert all types. gzip on; gzip_vary on; gzip_proxied any; # Can be enhance to 5, but it can slow you server # gzip_comp_level 5; # gzip_min_length 256; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; # HSTS (Force clients to interact with your website using HTTPS only) # For enhanced security, register your site here: https://hstspreload.org/ # WARNING: Don't use this if your site is not fully on HTTPS! # add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always; # Cloudflare / Max CDN fix location ~* \.(eot|otf|ttf|woff(?:2)?)$ { add_header Access-Control-Allow-Origin *; } # Do not save logs for these location = /favicon.ico { auth_basic off; allow all; log_not_found off; access_log off; } location = /robots.txt { auth_basic off; allow all; log_not_found off; access_log off; } # [REQUIRED EDIT IF MULTILANG] rewrite ^/es$ /es/ redirect; rewrite ^/es/(.*) /$1; rewrite ^/en$ /es/ redirect; rewrite ^/en/(.*) /$1; # Images rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.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$5.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$6.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$7.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$8.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$9.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$10.jpg last; rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last; # AlphaImageLoader for IE and fancybox rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last; # Web service API rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; # Installation sandbox rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last; # [REQUIRED EDIT] Change this block to your admin folder location /Backoffice/ { if (!-e $request_filename) { rewrite ^/.*$ /Backoffice/index.php last; } } # File security # .htaccess .DS_Store .htpasswd etc location ~ /\. { deny all; } # Source code directories location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ { deny all; } # Prevent exposing other sensitive files location ~ \.(yml|log|tpl|twig|sass)$ { deny all; } # Prevent injection of php files location /upload { location ~ \.php$ { deny all; } } location /img { location ~ \.php$ { deny all; } } Testing site: https://tamainut.info Apreciate your help. Edited May 25, 2019 by Castris Solved (see edit history) Link to comment Share on other sites More sharing options...
Dreamtheme Posted May 22, 2019 Share Posted May 22, 2019 Start by disable the CDN and all caches (Server and PrestaShop), Enable Debug mode on PrestaShop and check what errors it will display for you. Also check PrestaShop logs in Var folder. Furthermore, disable the friendly URL's and delete the .htaccess and you can try to delete the Var/Cache folder (prod or dev or both). Link to comment Share on other sites More sharing options...
Castris Posted May 22, 2019 Author Share Posted May 22, 2019 Hi. Hello Obviously in a test facility, there is no CDN, no caches, ... Obviously if we are pulling Nginx there is no .htaccess, and of course if we are talking about the URL Friendly problem, lol, there is no point in deactivating this. As for seeing the debug mode of the application layer, well it may be fine, although I am afraid that the problem is the rule of the server layer. Maybe this concept will escape. Sometimes it's better to keep quiet, than to say useless things Best regards Link to comment Share on other sites More sharing options...
Dreamtheme Posted May 22, 2019 Share Posted May 22, 2019 Hi, .htaccess may come with PrestaShop installation (especially if imported from other server). Obviously you did not mention if there is PS Cache turn on (its on by default) or CDN setup. Debug mode on application level can help you point out the direction of what is the server issue. Friendly URL do had problems with translations in the past with PS. But i'm sorry i tried to help good luck. Link to comment Share on other sites More sharing options...
Castris Posted May 24, 2019 Author Share Posted May 24, 2019 On Nginx aditionals directives: set $admin_dir /Backoffice; index index.php; # Redirect 404 errors to prestashop error_page 404 /index.php?controller=404; # Gzip Settings, convert all types. gzip on; gzip_vary on; gzip_proxied any; # Can be enhance to 5, but it can slow you server # gzip_comp_level 5; # gzip_min_length 256; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; # HSTS (Force clients to interact with your website using HTTPS only) # For enhanced security, register your site here: https://hstspreload.org/ # WARNING: Don't use this if your site is not fully on HTTPS! # add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always; # Cloudflare / Max CDN fix location ~* \.(eot|otf|ttf|woff(?:2)?)$ { add_header Access-Control-Allow-Origin *; } # Do not save logs for these location = /favicon.ico { auth_basic off; allow all; log_not_found off; access_log off; } location = /robots.txt { auth_basic off; allow all; log_not_found off; access_log off; } # [REQUIRED EDIT IF MULTILANG] rewrite ^/es$ /es/ redirect; rewrite ^/es/(.*) /$1; rewrite ^/en$ /en/ redirect; rewrite ^/en/(.*) /$1; rewrite ^/zh$ /zh/ redirect; rewrite ^/zh/(.*) /$1; # Images rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.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$5.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$6.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$7.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$8.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$9.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$10.jpg last; rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last; location ~ (/es|/en|/zh)/index\.php$ { try_files $uri $uri/ /index.php?$args; } try_files $uri $uri/ /index.php?$args; # Symfony controllers Specific for 1.7 location ~ /(international|_profiler|module|product|combination|specific-price)/(.*)$ { try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args; } # AlphaImageLoader for IE and fancybox rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last; # Web service API rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; # Installation sandbox rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last; # [REQUIRED EDIT] Change this block to your admin folder location /Backoffice/ { if (!-e $request_filename) { rewrite ^/.*$ /Backoffice/index.php last; } } # File security # .htaccess .DS_Store .htpasswd etc location ~ /\. { deny all; } # Source code directories location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ { deny all; } # Prevent exposing other sensitive files location ~ \.(yml|log|tpl|twig|sass)$ { deny all; } # Prevent injection of php files location /upload { location ~ \.php$ { deny all; } } location /img { location ~ \.php$ { deny all; } } #location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { # expires 30d; # add_header Cache-Control "public, no-transform"; #} #location ~* \.(jpg|jpeg|gif|png)$ { # expires 365d; #} #location ~* \.(pdf|css|html|js|swf)$ { # expires 2d; #} location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { expires 30d; add_header Pragma public; add_header Cache-Control "public"; } Of course "Good luck" has nothing to do with software engineering. Neither is it, checking logs that does not have to do with the problem, and not understanding the different layers that work in the operation of the software next to the system. Link to comment Share on other sites More sharing options...
Dreamtheme Posted May 24, 2019 Share Posted May 24, 2019 Castris, You come to the forums and ask for help. You refuse to check logs (PS, PHP, JavaScript logs), refuse to give information on your PS config and server setup and config, refuse to debug PS and instead you assuming it is specific issue with your the server, even the link you provided https://tamainut.info (The connection has timed out The server at tamainut.info is taking too long to respond.) is not working. With the little information you have given, the best we can do is some wild guess of what could be wrong. And when i tried to help you with the little information you gave, you start offending me on how little i know... Its not even clear if you are seeing cache version or not... and you speaking about "software engineering"... amazing! I think that your problem is of a different kind. Link to comment Share on other sites More sharing options...
Castris Posted May 25, 2019 Author Share Posted May 25, 2019 (edited) I don't refuse read logs. I'm Sysops for 30 years. First action on every investigation is logs. I refuse Useless comments when a user say: read .htaccess when question is about nginx. Nginx not read .htaccess file. I refuse when user speak about logs with question about application, when problem is not application. Is question about server, nginx with application. tamainut.info, is one domain only for testing porpouses, not for production. Bye, bye. Edited May 25, 2019 by Castris (see edit history) Link to comment Share on other sites More sharing options...
Dreamtheme Posted May 25, 2019 Share Posted May 25, 2019 I did not said to read .htaccess i said to DELETE it, together with manual deletion of the cache and disable the URL rewrite (from the app) so you can check if the issue is with the URL rewrite of your server or something else. You are getting 404 and URL rewrite is the first thing to investigate obviously and you want to make sure its not cache issue too... PrestaShop has pretty good debug mode and can pinpoint directly what the server issue is if you know how to use it, additionally whatever the problem is with server or app, its not "assuming", computers are about investigation and ruling out, not assumptions and fortune telling. There is known problem of URL rewrites with PrestaShop and Nginx. Whats the point to give test URL if it doesn't work. Its pity that for 30 years you didn't learn to read and behave. 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