netlantv Posted September 16, 2020 Share Posted September 16, 2020 Bonjour / Bonsoir à tous, J'ai installé le site sur mon serveur : Debian 10 Apache 2.4 Nginx Proxy Php 7.4.6 Version de Prestashop 1.7.7.0 MariaDB Limite de Memoire 256M Cloudflare : Cache TTL 4H SSL COMPLET Always HTTPS HSTS Activé HTTP/2 Always Online Config Nginx : server { listen XXX.XXX.XXX.XXX:443 ssl; server_name shop.laloutrefrancaise.fr shop.laloutrefrancaise.fr; ssl_certificate /home/XXX/conf/web/ssl.shop.laloutrefrancaise.fr.pem; ssl_certificate_key /home/XXX/conf/web/ssl.shop.laloutrefrancaise.fr.key; error_log /var/log/apache2/domains/shop.laloutrefrancaise.fr.error.log error; location / { proxy_pass https://XXX.XXX.XXX.XXX:8443; proxy_cache cache; proxy_cache_valid 15m; proxy_cache_valid 404 1m; proxy_no_cache $no_cache; proxy_cache_bypass $no_cache; proxy_cache_bypass $cookie_session $http_x_update; location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|ttf|otf|webp|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf|woff|woff2)$ { proxy_cache off; root /home/XXX/web/shop.laloutrefrancaise.fr/public_html; access_log /var/log/apache2/domains/shop.laloutrefrancaise.fr.log combined; access_log /var/log/apache2/domains/shop.laloutrefrancaise.fr.bytes bytes; expires max; try_files $uri @fallback; } } location /error/ { alias /home/XXX/web/shop.laloutrefrancaise.fr/document_errors/; } location @fallback { proxy_pass https://XXX.XXX.XXX.XXX:8443; } location ~ /\.ht {return 404;} location ~ /\.svn/ {return 404;} location ~ /\.git/ {return 404;} location ~ /\.hg/ {return 404;} location ~ /\.bzr/ {return 404;} include /home/XXX/conf/web/snginx.shop.laloutrefrancaise.fr.conf*; } Config Apache : <VirtualHost XXX.XXX.XXX.XXX:8443> ServerName shop.laloutrefrancaise.fr ServerAlias shop.laloutrefrancaise.fr ServerAdmin [email protected] DocumentRoot /home/XXX/web/shop.laloutrefrancaise.fr/public_html ScriptAlias /cgi-bin/ /home/XXX/web/shop.laloutrefrancaise.fr/cgi-bin/ Alias /vstats/ /home/XXX/web/shop.laloutrefrancaise.fr/stats/ Alias /error/ /home/XXX/web/shop.laloutrefrancaise.fr/document_errors/ #SuexecUserGroup XXX XXX CustomLog /var/log/apache2/domains/shop.laloutrefrancaise.fr.bytes bytes CustomLog /var/log/apache2/domains/shop.laloutrefrancaise.fr.log combined ErrorLog /var/log/apache2/domains/shop.laloutrefrancaise.fr.error.log <Directory /home/XXX/web/shop.laloutrefrancaise.fr/stats> AllowOverride All </Directory> <Directory /home/XXX/web/shop.laloutrefrancaise.fr/public_html> AllowOverride All SSLRequireSSL Options +Includes -Indexes +ExecCGI </Directory> SSLEngine on SSLVerifyClient none SSLCertificateFile /home/XXX/conf/web/ssl.shop.laloutrefrancaise.fr.crt SSLCertificateKeyFile /home/XXX/conf/web/ssl.shop.laloutrefrancaise.fr.key SSLCertificateChainFile /home/XXX/conf/web/ssl.shop.laloutrefrancaise.fr.ca # <IfModule mod_ruid2.c> # RMode config # RUidGid admin admin # RGroups www-data # </IfModule> # <IfModule itk.c> # AssignUserID admin admin # </IfModule> <FilesMatch \.php$> SetHandler "proxy:unix:/run/php/php7.4-fpm-shop.laloutrefrancaise.fr.sock|fcgi://localhost/" </FilesMatch> SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 IncludeOptional /home/admin/conf/web/sapache2.shop.laloutrefrancaise.fr.conf* </VirtualHost> Config .htaccess # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again # .htaccess automaticaly generated by PrestaShop e-commerce open-source solution # http://www.prestashop.com - http://www.prestashop.com/forums <IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> RewriteEngine on #Domain: shop.laloutrefrancaise.fr RewriteRule . - [E=REWRITEBASE:/] RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L] # Images RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^shop.laloutrefrancaise.fr$ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L] # AlphaImageLoader for IE and fancybox RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L] # Dispatcher RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L] </IfModule> AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf AddType application/font-woff .woff AddType font/woff2 .woff2 <IfModule mod_headers.c> <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> <Files composer.lock> # Apache 2.2 <IfModule !mod_authz_core.c> Order deny,allow Deny from all </IfModule> # Apache 2.4 <IfModule mod_authz_core.c> Require all denied </IfModule> </Files> <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType text/css "access plus 1 week" ExpiresByType text/javascript "access plus 1 week" ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/vnd.microsoft.icon "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType font/woff2 "access plus 1 year" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType font/opentype "access plus 1 year" ExpiresByType font/ttf "access plus 1 year" ExpiresByType font/otf "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType application/x-font-otf "access plus 1 year" </IfModule> <IfModule mod_headers.c> Header unset Etag </IfModule> FileETag none <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml </IfModule> </IfModule> #If rewrite mod isn't enabled ErrorDocument 404 /index.php?controller=404 # ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again Le Problème : A chaque fois que je rajoute un produit / changement de logo ou d'image sur le backoffice aucun problème je vois bien mon image mais sur le front j’obtiens un erreur 404 et ceux uniquement sur le front. Je viens de découvrir ce soir que apres 3h mais image sont enfin là. Je me suis dis que c’était un problème de cache, j'ai vider le cache CLOUDFLARE, et PRESTASHOP rien a faire toujours une erreur 404. Merci d'avance pour votre aide Link to comment Share on other sites More sharing options...
doekia Posted September 17, 2020 Share Posted September 17, 2020 Tu dois attendre 15mn avant de purger le cache cloudflare dans la mesure ou ton nginx fait lui aussi un cache (de 15mn) Link to comment Share on other sites More sharing options...
netlantv Posted September 17, 2020 Author Share Posted September 17, 2020 Petit update : Le problème n'a pas l'air de venir du cache, ce matin toujours un problème. Mais j'ai remarqué que quand je desactive le Friendly URL, presque tous les images fonctionnes, je me demande si c'est pas plus un problème de htaccess ou de reverse proxy de nginx. 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