g_escande81 Posted December 5, 2013 Share Posted December 5, 2013 Bonjour, J'ai trouver une config de nginx sur internet pour prestashop (avec php-fpm). Cependant l'erreur 404 ne fonctionne pas correctement en effet s'affiche la page par défaut de nginx et pas celle de prestashop. Y a t'il une autre configuration à faire que seulement error_page 404 /index.php?controller=404; (j'ai redémarrer nginx plusieurs fois) Ci-dessous le fichier de configuration d'un de mes vhosts. Merci de votre aide. server { listen 80; server_name www.monsite.com monsite.com; root /home/monsite/public_html; access_log /var/log/nginx/monsite.access.log; error_log /var/log/nginx/monsite.error.log; if ($http_host != "www.monsite.com") { rewrite ^ http://www.monsite.com$request_uri permanent; } index index.php index.html; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). location ~ /\. { deny all; access_log off; log_not_found off; } rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; rewrite ^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg last; rewrite ^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg 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; ### qsa rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 last; rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1$3 last; rewrite ^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 last; rewrite ^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 last; rewrite ^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 last; rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1$3 last; rewrite ^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms_category=$1$3 last; ### //qsa rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last; ### qsa rewrite ^/page-non-trouvee(.*)$ /404.php$1 last; rewrite ^/adresse(.*)$ /address.php$1 last; rewrite ^/adresses(.*)$ /addresses.php$1 last; rewrite ^/authentification(.*)$ /authentication.php$1 last; rewrite ^/meilleures-ventes(.*)$ /best-sales.php$1 last; rewrite ^/panier(.*)$ /cart.php$1 last; rewrite ^/contactez-nous(.*)$ /contact-form.php$1 last; rewrite ^/bons-de-reduction(.*)$ /discount.php$1 last; rewrite ^/suivi-commande-invite(.*)$ /guest-tracking.php$1 last; rewrite ^/historique-des-commandes(.*)$ /history.php$1 last; rewrite ^/identite(.*)$ /identity.php$1 last; rewrite ^/marques(.*)$ /manufacturer.php$1 last; rewrite ^/mon-compte(.*)$ /my-account.php$1 last; rewrite ^/nouveaux-produits(.*)$ /new-products.php$1 last; rewrite ^/commande(.*)$ /order.php$1 last; rewrite ^/details-de-la-commande(.*)$ /order-follow.php$1 last; rewrite ^/commande-rapide(.*)$ /order-opc.php$1 last; rewrite ^/avoirs(.*)$ /order-slip.php$1 last; rewrite ^/mot-de-passe-oublie(.*)$ /password.php$1 last; rewrite ^/promotions(.*)$ /prices-drop.php$1 last; rewrite ^/recherche(.*)$ /search.php$1 last; rewrite ^/plan-du-site(.*)$ /sitemap.php$1 last; rewrite ^/magasins(.*)$ /stores.php$1 last; rewrite ^/fournisseurs(.*)$ /supplier.php$1 last; try_files $uri $uri/ /index.php$is_args$args; error_page 404 /index.php?controller=404; location ~* \.(gif)$ { expires 2592000s; } location ~* \.(jpeg|jpg)$ { expires 2592000s; } location ~* \.(png)$ { expires 2592000s; } location ~* \.(css)$ { expires 604800s; } location ~* \.(js|jsonp)$ { expires 604800s; } location ~* \.(js)$ { expires 604800s; } location ~* \.(ico)$ { expires 31536000s; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } } Link to comment Share on other sites More sharing options...
cedced Posted December 12, 2013 Share Posted December 12, 2013 Nous rencontrons le meme probleme avec notre serveur NGINX, impossible de faire fonctionner la redirection vers la page 404 d'un theme Presta. Est-ce que quelqu'un utilise Presta avec NGINX et a sa page 404 Presta qui s'affiche et non celle du serveur? Link to comment Share on other sites More sharing options...
jahazzz Posted December 12, 2013 Share Posted December 12, 2013 Il faut supprimer la ligne fastcgi_intercept_errors on; de la conf du vhost 2 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