Difference between revisions of "Prestashop Nginx Config"
Jump to navigation
Jump to search
Adam.birds (talk | contribs) (Created page with "'''Below is the Nginx config for Prestashop:''' <pre> upstream examplecombackend { server unix:/var/run/php-fcgi-examplecom.sock; } server { listen 80;...") |
Adam.birds (talk | contribs) |
||
| Line 75: | Line 75: | ||
</pre> | </pre> | ||
| + | [[Category:Prestashop]] | ||
[[Category:Nginx]] | [[Category:Nginx]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Contents]] | [[Category:Contents]] | ||
Latest revision as of 17:29, 30 April 2016
Below is the Nginx config for Prestashop:
upstream examplecombackend {
server unix:/var/run/php-fcgi-examplecom.sock;
}
server {
listen 80;
server_name example.com;
root /var/www/vhosts/example.com/htdocs;
index index.php index.html;
access_log /var/www/vhosts/example.com/access.log;
error_log /var/www/vhosts/example.com/error.log warn;
location / {
try_files $uri $uri/ @handler;
index index.php index.html;
}
# PrestaShop rewrite rules
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/c/$1$2.jpg last;
rewrite "^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)-([a-zA-Z0-9-]*).html(.*)$" /product.php?id_product=$3&isolang=$1$5 last;
rewrite "^/lang-([a-z]{2})/([0-9]+)-([a-zA-Z0-9-]*).html(.*)$" /product.php?id_product=$2&isolang=$1$4 last;
rewrite "^/lang-([a-z]{2})/([0-9]+)-([a-zA-Z0-9-]*)(.*)$" /category.php?id_category=$2&isolang=$1 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-]*).html(.*)$ /product.php?id_product=$1$3 last;
rewrite ^/([0-9]+)-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 last;
rewrite ^/content/([0-9]+)-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 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 "^/lang-([a-z]{2})/(.*)$" /$2?isolang=$1 last;
# static file cache configuration
location ~* .(gif)$ {
expires 2592000s;
}
location ~* .(jpeg|jpg)$ {
expires 2592000s;
}
location ~* .(png)$ {
expires 2592000s;
}
location ~* .(css)$ {
expires 604800s;
}
location ~* .(js)$ {
expires 604800s;
}
location ~* .(js)$ {
expires 604800s;
}
location ~* .(ico)$ {
expires 31536000s;
}
# php-fpm configuration
location ~ .php$ {
root /var/www/vhosts/example.com/htdocs;
try_files $uri =404;
fastcgi_pass examplecombackend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}