1
+ # WEBSITES MAPPING
2
+ map $http_host $MAGE_RUN_CODE {
3
+
4
+ default base;
5
+ ## For multi-store configuration add here your domain-website codes
6
+ # dominio-es.lo es;
7
+ # dominio-ch.lo ch;
8
+ # dominio-de.lo de;
9
+ }
10
+
1
11
upstream fastcgi_backend {
2
12
server unix:/sock/docker.sock;
3
13
}
4
14
5
15
server {
6
16
listen 8000;
17
+ ## Add here your domains or leave "localhost" wildcard
7
18
server_name localhost;
8
19
9
20
set $MAGE_ROOT /var/www/html;
10
21
set $MAGE_MODE developer;
22
+ set $MAGE_RUN_TYPE website;
11
23
12
24
root $MAGE_ROOT/pub;
13
25
14
26
index index.php;
15
27
autoindex off;
16
- charset off;
17
-
28
+ charset UTF-8;
29
+ client_max_body_size 64M;
30
+ error_page 404 403 = /errors/404.php;
18
31
add_header 'X-Content-Type-Options' 'nosniff';
32
+ #add_header "X-UA-Compatible" "IE=Edge";
19
33
20
- location /setup {
21
- root $MAGE_ROOT;
34
+ # Deny access to sensitive files
35
+ location /.user.ini {
36
+ deny all;
37
+ }
22
38
39
+ # PHP entry point for setup application
40
+ location ~* ^/setup($|/) {
41
+ root $MAGE_ROOT;
23
42
location ~ ^/setup/index.php {
43
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
24
44
fastcgi_pass fastcgi_backend;
45
+
46
+ fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
47
+ fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600";
48
+ fastcgi_read_timeout 600s;
49
+ fastcgi_connect_timeout 600s;
50
+
25
51
fastcgi_index index.php;
26
52
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
27
- include fastcgi_params;
53
+ include fastcgi_params;
28
54
}
29
55
30
56
location ~ ^/setup/(?!pub/). {
@@ -35,20 +61,21 @@ server {
35
61
add_header X-Frame-Options "SAMEORIGIN";
36
62
}
37
63
}
38
-
39
- location /update {
64
+
65
+ # PHP entry point for update application
66
+ location ~* ^/update($|/) {
40
67
root $MAGE_ROOT;
41
68
42
69
location ~ ^/update/index.php {
43
70
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
44
71
fastcgi_pass fastcgi_backend;
45
72
fastcgi_index index.php;
46
73
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
47
- fastcgi_param PATH_INFO $fastcgi_path_info;
48
- include fastcgi_params;
74
+ fastcgi_param PATH_INFO $fastcgi_path_info;
75
+ include fastcgi_params;
49
76
}
50
77
51
- # deny everything but index.php
78
+ # Deny everything but index.php
52
79
location ~ ^/update/(?!pub/). {
53
80
deny all;
54
81
}
@@ -59,57 +86,53 @@ server {
59
86
}
60
87
61
88
location / {
62
- try_files $uri $uri/ /index.php? $args;
89
+ try_files $uri $uri/ /index.php$is_args $args;
63
90
}
64
-
65
- location /pub {
91
+
92
+ location /pub/ {
66
93
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
67
94
deny all;
68
95
}
69
-
70
- alias $MAGE_ROOT/pub;
96
+ alias $MAGE_ROOT/pub/;
71
97
add_header X-Frame-Options "SAMEORIGIN";
72
98
}
73
-
99
+
74
100
location /static/ {
75
101
if ($MAGE_MODE = "production") {
76
102
expires max;
77
103
}
78
104
79
- # remove signature of static files used to overcome browser cache
105
+ # Remove signature of the static files that is used to overcome the browser cache
80
106
location ~ ^/static/version {
81
107
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
82
108
}
83
109
84
- location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
110
+ location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json )$ {
85
111
add_header Cache-Control "public";
86
112
add_header X-Frame-Options "SAMEORIGIN";
87
113
expires +1y;
88
-
114
+
89
115
if (!-f $request_filename) {
90
116
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
91
117
}
92
118
}
93
-
94
119
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
95
120
add_header Cache-Control "no-store";
96
121
add_header X-Frame-Options "SAMEORIGIN";
97
- expires off;
98
-
122
+ expires off;
123
+
99
124
if (!-f $request_filename) {
100
- rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
125
+ rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
101
126
}
102
127
}
103
-
104
128
if (!-f $request_filename) {
105
129
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
106
130
}
107
-
108
131
add_header X-Frame-Options "SAMEORIGIN";
109
132
}
110
-
133
+
111
134
location /media/ {
112
- try_files $uri $uri/ /get.php? $args;
135
+ try_files $uri $uri/ /get.php$is_args $args;
113
136
114
137
location ~ ^/media/theme_customization/.*\.xml {
115
138
deny all;
@@ -119,59 +142,79 @@ server {
119
142
add_header Cache-Control "public";
120
143
add_header X-Frame-Options "SAMEORIGIN";
121
144
expires +1y;
122
- try_files $uri $uri/ /get.php? $args;
145
+ try_files $uri $uri/ /get.php$is_args $args;
123
146
}
124
-
125
147
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
126
148
add_header Cache-Control "no-store";
127
149
add_header X-Frame-Options "SAMEORIGIN";
128
- expires off;
129
- try_files $uri $uri/ /get.php? $args;
150
+ expires off;
151
+ try_files $uri $uri/ /get.php$is_args $args;
130
152
}
131
-
132
153
add_header X-Frame-Options "SAMEORIGIN";
133
154
}
134
-
155
+
135
156
location /media/customer/ {
136
157
deny all;
137
158
}
138
-
159
+
139
160
location /media/downloadable/ {
140
161
deny all;
141
162
}
142
-
143
- location /media/import/ {
144
- deny all;
145
- }
146
163
147
- location ~ /media/theme_customization/.*\.xml$ {
164
+ location /media/import/ {
148
165
deny all;
149
166
}
150
-
167
+
151
168
location /errors/ {
152
- try_files $uri =404;
153
- }
154
-
155
- location ~ ^/errors/.*\.(xml|phtml)$ {
156
- deny all;
157
- }
158
-
159
- location ~ cron\.php {
160
- deny all;
169
+ location ~* \.(xml|phtml)$ {
170
+ deny all;
171
+ }
161
172
}
162
173
163
- location ~ (index|get|static|report|404|503)\.php$ {
174
+ # PHP entry point for main application
175
+ location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
164
176
try_files $uri =404;
165
177
fastcgi_pass fastcgi_backend;
166
-
178
+ fastcgi_buffers 1024 4k;
179
+ fastcgi_buffer_size 32k;
180
+
167
181
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
168
- fastcgi_param PHP_VALUE "max_execution_time=600";
182
+ fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
183
+ fastcgi_param PHP_VALUE "max_input_vars=10000";
169
184
fastcgi_read_timeout 600s;
170
185
fastcgi_connect_timeout 600s;
171
186
fastcgi_param MAGE_MODE $MAGE_MODE;
172
-
187
+ fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
188
+ fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;
189
+
173
190
fastcgi_index index.php;
174
191
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
175
- include fastcgi_params;
192
+ include fastcgi_params;
176
193
}
177
- }
194
+
195
+ gzip on;
196
+ gzip_disable "msie6";
197
+
198
+ gzip_comp_level 6;
199
+ gzip_min_length 1100;
200
+ gzip_buffers 16 8k;
201
+ gzip_proxied any;
202
+ gzip_types
203
+ text/plain
204
+ text/css
205
+ text/js
206
+ text/xml
207
+ text/javascript
208
+ application/javascript
209
+ application/x-javascript
210
+ application/json
211
+ application/xml
212
+ application/xml+rss
213
+ image/svg+xml;
214
+ gzip_vary on;
215
+
216
+ # Banned locations (only reached if the earlier PHP entry point regexes don't match)
217
+ location ~* (\.php$|\.htaccess$|\.git) {
218
+ deny all;
219
+ }
220
+ }
0 commit comments