-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.sample
240 lines (208 loc) · 5 KB
/
nginx.conf.sample
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
## X-Cart 5 nginx sample configuration
## Copy this file to your /etc/nginx directory
## and include it in the server {} block.
##
## DO NOT include the sample file directly because
## it is considered a security vulnerability and
## may lead to a breach.
##
## Example configuration:
##
# upstream fastcgi_xcart {
# # use tcp connection
# server 127.0.0.1:9000;
# # or socket
# # server unix:/var/run/php5-fpm.sock;
# # server unix:/var/run/php/php7.0-fpm.sock;
# }
# server {
# listen 80 default_server;
# server_name xcart.local;
# root /var/www/xcart;
#
# include /etc/nginx/conf/xcart.conf;
# }
index cart.php;
charset UTF-8;
location ^~ /src/classes {
location ~* \.(png|svg) {
try_files $uri =404;
}
return 403;
}
location ^~ /src/files {
location ^~ /src/files/attachments {
try_files $uri =404;
}
location ^~ /src/files/vendor {
try_files $uri =404;
}
location ^~ /src/files/video {
try_files $uri =404;
}
return 403;
}
location ^~ /src/images {
location ~* \.(jpg|jpeg|gif|png|bmp|ico|tiff|flv|swf|svg|pdf) {
try_files $uri =404;
}
return 403;
}
location ^~ /src/skins {
location ~* \.(tpl|twig|php|pl|conf) {
deny all;
}
try_files $uri =404;
}
location ^~ /src/var {
location ~* \.(gif|jpe?g|png|bmp|ico|css|js|webm|ogg|mp4|avi) {
try_files $uri =404;
}
return 403;
}
location ~ /src/(vendor|sql|lib|etc|Includes)/ {
deny all;
}
location ~ /src/var/(export|import)/ {
deny all;
}
location ^~ /src/service/ {
location ^~ /src/service/static/ {
try_files $uri =404;
}
return 403;
}
location /src/ {
try_files $uri $uri/ @handler;
}
location @handler {
rewrite ^/src/sitemap.xml(\?.+)?$ /src/cart.php?target=sitemap;
rewrite ^/src/service.php(.*)?$ /src/service.php last;
rewrite ^/src/(.*)$ /src/cart.php?url=$1 last;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass fastcgi_xcart;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300s;
fastcgi_connect_timeout 300s;
}
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
image/svg+xml;
gzip_vary on;
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
location ~* (\.php$|\.htaccess$|\.git) {
deny all;
}
##########
# No web dir
##########
server {
index cart.php;
charset UTF-8;
location ^~ /classes {
location ~* \.(png|svg) {
try_files $uri =404;
}
return 403;
}
location ^~ /files {
location ^~ /files/attachments {
try_files $uri =404;
}
location ^~ /files/vendor {
try_files $uri =404;
}
location ^~ /files/video {
try_files $uri =404;
}
return 403;
}
location ^~ /images {
location ~* \.(jpg|jpeg|gif|png|bmp|ico|tiff|flv|swf|svg|pdf) {
try_files $uri =404;
}
return 403;
}
location ^~ /skins {
location ~* \.(tpl|twig|php|pl|conf) {
deny all;
}
try_files $uri =404;
}
location ^~ /var {
location ~* \.(gif|jpe?g|png|bmp|ico|css|js|webm|ogg|mp4|avi) {
try_files $uri =404;
}
return 403;
}
location ~ /(vendor|sql|lib|etc|Includes)/ {
deny all;
}
location ~ /var/(export|import)/ {
deny all;
}
location ^~ /service/ {
location ^~ /service/static/ {
try_files $uri =404;
}
return 403;
}
location / {
try_files $uri $uri/ @handler;
}
location @handler {
rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
rewrite ^/service.php(.*)?$ /service.php last;
rewrite ^/(.*)$ /cart.php?url=$1 last;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass fastcgi_xcart;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_connect_timeout 300s;
}
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
image/svg+xml;
gzip_vary on;
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
location ~* (\.php$|\.htaccess$|\.git) {
deny all;
}
}