-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfpm-prestashop.conf
168 lines (96 loc) · 4.4 KB
/
fpm-prestashop.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# nginx config to run prestashop 1.6.x
# the latest commit is available at https://github.com/juliyvchirkov/nginx-prestashop
#
# v2 09/28/2017 https://github.com/juliyvchirkov/nginx-prestashop/releases/tag/v2.0
#
# this port is initially based on original settings & restrictions from prestashop bundle aimed at apache httpd
#
# v2 has been completely revised & improved. the ruleset has been rearranged in native nginx way to utilize
# its power, thus forcing pages to load up to 5-10x faster
#
# [nb] the last rule https://github.com/juliyvchirkov/nginx-prestashop/blob/master/fpm-prestashop.conf#L166
# on line 166 at the last block of this config assumes slight preconfiguration at nginx & php-fpm
# daemon pool config files to get the whole thing working properly
# please explore https://github.com/juliyvchirkov/nginx-prestashop/blob/master/README.md for details
#
location ~ "^/api/?(.*)$" {
try_files $uri /webservice/dispatcher.php?url=$1;
}
location ~* "^/(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$1$2.jpg;
}
location ~* "^/(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$1$2$3.jpg;
}
location ~* "^/(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$1$2$3$4.jpg;
}
location ~* "^/(\d)(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg;
}
location ~* "^/(\d)(\d)(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg;
}
location ~* "^/(\d)(\d)(\d)(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg;
}
location ~* "^/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg;
}
location ~* "^/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg;
}
location ~* "^/c/(\d+)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/c/$1$2.jpg;
}
location ~* "^/c/(\d+)(-\w+_\w+)?(?:-\d+)?/.+\.jpg$" {
return 308 /img/c/$1$2.jpg;
}
location ~* "^/(?:c/)?(\d+)(-\d+)?(_\w+)(?:-\d+)?/.+\.jpg$" {
return 308 /img/c/$1$2$3.jpg;
}
location ~ "^/[a-z]{2}/index.php" {
return 308 /index.php$is_args$args;
}
location ~ "^/(j|cs)s/([^/]+)\.(?:j|cs)s$" {
try_files $uri /$1s/retro-compat.$1s.php?file=$2.$1s;
expires epoch;
add_header Pragma "no-cache";
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
location ~* "/img/cms/.+\.(jpg|jpeg|gif|png|bmp|tiff|svg|pdf|mov|mpeg|mp4|avi|mpg|wma|flv|webm)$" {
allow all;
}
location ~ "^/img/cms/" {
deny all;
}
location ~ "\.tpl$" {
deny all;
}
location ~ "^/upload/.+\.php$" {
deny all;
}
location ~ "^/backoffice/(?:backups|export|import|tabs)/" {
deny all;
}
location ~ "^/(classes|config|download|log|override|tools)/" {
deny all;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
set $presta404page "/index.php?controller=404";
error_page 404 $presta404page;
error_page 500 /error500.html;
location ~ "\.php$" {
try_files $uri =404 $presta404page;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 256k;
fastcgi_send_timeout 30s;
fastcgi_read_timeout 30s;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass php;
}