Page 1 of 1

Prestashop Template / PHP5-FPM + NGINX

Posted: Fri Nov 13, 2015 7:02 pm
by mephivio
Hi
Does anyone have a prestashop template for PHP5-FPM + NGINX?
Thanks

.J.

Re: Prestashop Template / PHP5-FPM

Posted: Fri Nov 13, 2015 8:20 pm
by skurudo
default does not suit prestashop?

Re: Prestashop Template / PHP5-FPM

Posted: Sat Nov 14, 2015 3:43 pm
by mephivio
if you activate URL rewriting, it stops to work .... in addition with default template in NGINX

Re: Prestashop Template / PHP5-FPM

Posted: Sat Nov 14, 2015 7:51 pm
by tjebbeke
mephivio wrote:if you activate URL rewriting, it stops to work .... in addition with default template in NGINX
If that works through .htaccess file than it's normal that it doesn't work. Nginx can't handle this.

Re: Prestashop Template / PHP5-FPM

Posted: Sun Nov 15, 2015 10:12 am
by itsme
tjebbeke wrote:
mephivio wrote:if you activate URL rewriting, it stops to work .... in addition with default template in NGINX
If that works through .htaccess file than it's normal that it doesn't work. Nginx can't handle this.

Maybe you can make your own template with the settings mentioned in this link http://doc.prestashop.com/display/PS16/ ... iendlyURLs ?

Re: Prestashop Template / PHP5-FPM + NGINX

Posted: Sun Nov 15, 2015 4:26 pm
by skurudo
mephivio wrote: Does anyone have a prestashop template for PHP5-FPM + NGINX?
How about test template for PrestaShop?
Can you be my favorite "lab rat"? ;-)

Re: Prestashop Template / PHP5-FPM + NGINX

Posted: Mon Nov 16, 2015 8:53 pm
by mephivio
Ok - i worked on this template - it works

server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

# Custom Prestashop 404 page
#error_page 404 /index.php?controller=404;

location / {

rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

add_header Access-Control-Allow-Headers Content-Type;
add_header Access-Control-Max-Age 86400;

try_files $uri $uri/ /index.php?$args;

location ~* \.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$1$2.$4 last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$1$2$3.$5 last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$1$2$3$4.$6 last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.$7 last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.$8 last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.$9 last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.$10 last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.(.*)$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.$11 last;
rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.(.*)$ /img/c/$1$2.$4 last;
rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.(.*)$ /img/c/$1.$3 last;
rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.(.*)$ /img/c/$1$2.$4 last;

# AlphaImageLoader for IE and fancybox
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;

access_log off;
log_not_found off;
expires 1w;
add_header Cache-Control public;
}

location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 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_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}


location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}

location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}