prestashop example
This commit is contained in:
84
examples/prestashop/server-confs/prestashop.conf
Normal file
84
examples/prestashop/server-confs/prestashop.conf
Normal file
@@ -0,0 +1,84 @@
|
||||
# remove ports in redirects
|
||||
port_in_redirect off;
|
||||
|
||||
# Redirect 404 errors to prestashop
|
||||
error_page 404 /index.php?controller=404;
|
||||
|
||||
# Force pdf files to be downloaded
|
||||
location ~* \.pdf$ {
|
||||
add_header Content-Disposition Attachment;
|
||||
}
|
||||
|
||||
# Force files inupload directory to be downloaded
|
||||
location ~ ^/upload/ {
|
||||
add_header Content-Disposition Attachment;
|
||||
}
|
||||
|
||||
# Images
|
||||
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
|
||||
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
|
||||
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
|
||||
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
|
||||
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
|
||||
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$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])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
|
||||
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/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
|
||||
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
|
||||
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
|
||||
|
||||
# AlphaImageLoader for IE and fancybox
|
||||
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
|
||||
|
||||
# Web service API
|
||||
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
|
||||
|
||||
# Installation sandbox
|
||||
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
|
||||
|
||||
# [REQUIRED EDIT] Change this block to your admin folder
|
||||
location /myadmin/ {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/.*$ /myadmin/index.php last;
|
||||
}
|
||||
}
|
||||
|
||||
# File security
|
||||
# .htaccess .DS_Store .htpasswd etc
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
# Source code directories
|
||||
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
|
||||
deny all;
|
||||
}
|
||||
# vendor in modules directory
|
||||
location ~ ^/modules/.*/vendor/ {
|
||||
deny all;
|
||||
}
|
||||
# Prevent exposing other sensitive files
|
||||
location ~ \.(yml|log|tpl|twig|sass)$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Prevent injection of php files
|
||||
location /upload {
|
||||
location ~ \.php$ {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
location /img {
|
||||
location ~ \.php$ {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
# [REQUIRED EDIT] PHP FPM part
|
||||
location ~ \.php$ {
|
||||
try_files $fastcgi_script_name /index.php$uri&$args =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED /var/www/html/$fastcgi_path_info;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
|
||||
fastcgi_pass myprestashop:9000;
|
||||
}
|
||||
Reference in New Issue
Block a user