Elitius Posted March 6, 2014 Share Posted March 6, 2014 (edited) Hello, Je m'arrache les cheveux depuis cet aprem pour configurer correctement PS 1.6 multishop avec Nginx. J'active d'abord l'url rewriting, ca ne l'est pas par défaut. J'ai d'abord repris l'exemple dispo sur la doc: http://doc.prestashop.com/display/PS15/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs Tout fonctionne bien sauf pour les images qui ne s'affichent pas. J'ai vu dans le .htaccess une directive qu'il n'y a pas dans la doc; rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last; Mais ça ne marche pas mieux Pour le multiboutique c'est pire, il n'y a que le texte qui s'affiche, les CSS/images/etc ne chargent pas. Merci d'avance! Edited March 6, 2014 by Elitius (see edit history) Link to comment Share on other sites More sharing options...
Elitius Posted March 6, 2014 Author Share Posted March 6, 2014 (edited) Nouvel essai avec la 1.6.0.4 qui m'a pondu un .htaccess plus propre. Voila ce que j'ai pu traduire: location / { rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$1$2$3.jpg break; rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$1$2$3$4.jpg break; rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$1$2$3$4$5.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$1$2$3$4$5$6.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg break; 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/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg break; if (-e $request_filename){ rewrite ^(.*)$ /index.php break; } } location /api { rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 break; } location /c { rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/$1$2$3.jpg break; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/$1$2.jpg break; } location /images_ie { rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 break; } En théorie ça devrait fonctionner vu que ça marche sous Apache, mais ça coince au niveau de ça: if (-e $request_filename){ rewrite ^(.*)$ /index.php break; } Qui pourtant me semble correct. Edited March 6, 2014 by Elitius (see edit history) Link to comment Share on other sites More sharing options...
Alexmp4 Posted March 18, 2014 Share Posted March 18, 2014 Salut, J'ai le même soucis. Enfin j'ai ni images ni liens vers les produits :s As tu trouvé une solution ? Link to comment Share on other sites More sharing options...
Elitius Posted March 19, 2014 Author Share Posted March 19, 2014 Salut, les liens fonctionnent (c'est pas compliqué avec Nginx) par contre les photos que dalle. Nginx est officiellement recommande pour presta mais visiblement aucun test n'a été fait pdant le développement. Link to comment Share on other sites More sharing options...
Sovanna Posted March 30, 2014 Share Posted March 30, 2014 (edited) vous avez réussi à trouver ? J'ai le même souci que vous j'ai suivi le http://lien http://doc.prestashop.com/display/PS15/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs et pour moi ça fonctionne (liens et images aussi) Edited March 30, 2014 by Sovanna (see edit history) Link to comment Share on other sites More sharing options...
Elitius Posted April 5, 2014 Author Share Posted April 5, 2014 Bonjour désolé j'avais zappé votre message, non aucun changement, les URL sont OK mais pas les images. Link to comment Share on other sites More sharing options...
Elitius Posted April 8, 2014 Author Share Posted April 8, 2014 J'ai tenté avec une 1.5 et j'ai exactement le même souci. Je penche donc pour un souci au niveau de Nginx, j'utilise la version 1.4.7. L'URL rewriting fonctionne donc je pense que le souci est ailleurs. Link to comment Share on other sites More sharing options...
Elitius Posted April 12, 2014 Author Share Posted April 12, 2014 Bump Link to comment Share on other sites More sharing options...
Gregory Roussac Posted April 14, 2014 Share Posted April 14, 2014 Bonjour Ce post a été déplacé car il devait se trouver dans la section rapport de bugs je suppose. Or ce n'est porbablement qu'un problème de config de vhost. Un collègue vient de me passer sa conf 1.5/1.6 server { listen 80; ssl off; server_name mysite.fr; root /home/mysite/www/public_html/prestashop/; index index.html index.htm index.php; access_log /var/log/nginx/mysite.fr.access.log; error_log /var/log/nginx/mysite.fr.error.log; location /install-dev/ { try_files $uri $uri/ /index.php; } location /admin-dev/ { try_files $uri $uri/ /index.php; } location / { index /index.php; rewrite ^/install-dev$ http://mysite.fr/install-dev/index.php last; rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$1$2.jpg last; rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last; rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+.jpg$ /img/c/$1.jpg last; rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last; add_header Access-Control-Allow-Headers Content-Type; add_header Access-Control-Max-Age 86400; try_files $uri $uri/ /index.php?$args; } location ~ \.php(.*)$ { try_files $uri =404; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm/mysock.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } Cordialement Link to comment Share on other sites More sharing options...
Elitius Posted April 14, 2014 Author Share Posted April 14, 2014 (edited) Bonjour, Quelle est la version de Nginx de votre collègue ? Edit: Pas de changements avec sa config. Edited April 14, 2014 by Elitius (see edit history) Link to comment Share on other sites More sharing options...
Gregory Roussac Posted April 14, 2014 Share Posted April 14, 2014 Re, 1.2.1 Link to comment Share on other sites More sharing options...
Elitius Posted April 14, 2014 Author Share Posted April 14, 2014 Testé sur une install avec Nginx 1.2.1 (fourni avec Debian 7) et la config donnée fonctionne parfaitement. Du coup le souci vient bien de Nginx 1.4.7 mais je suis incapable de trouver la solution a ce problème.. Link to comment Share on other sites More sharing options...
Elitius Posted April 16, 2014 Author Share Posted April 16, 2014 Testé sur Ubuntu server 13.10 avec Nginx 1.4.1, même souci. Link to comment Share on other sites More sharing options...
Elitius Posted April 17, 2014 Author Share Posted April 17, 2014 (edited) Trouvé une config fonctionnelle sur Nginx 1.2+ http://www.prestashop.com/forums/topic/321261-seo-friendly-nginx-rewrites/?do=findComment&comment=1637851 Edited April 17, 2014 by Elitius (see edit history) Link to comment Share on other sites More sharing options...
SHIROKO Posted August 24, 2014 Share Posted August 24, 2014 Nouvel essai avec la 1.6.0.4 qui m'a pondu un .htaccess plus propre. Voila ce que j'ai pu traduire: location / { rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$1$2$3.jpg break; rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$1$2$3$4.jpg break; rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$1$2$3$4$5.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$1$2$3$4$5$6.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg break; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg break; 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/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg break; if (-e $request_filename){ rewrite ^(.*)$ /index.php break; } } location /api { rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 break; } location /c { rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/$1$2$3.jpg break; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/$1$2.jpg break; } location /images_ie { rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 break; } En théorie ça devrait fonctionner vu que ça marche sous Apache, mais ça coince au niveau de ça: if (-e $request_filename){ rewrite ^(.*)$ /index.php break; } Qui pourtant me semble correct. Il manque le ' ! ' devant -e et remplacer break par last : if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; } cordialement 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