Skip to content

Commit e728586

Browse files
committed
Some fixes in configuration files:
after upgrade from D6 to D7 uploaded in D6 images stay in there old path; added htc extention to static served files; restrict direct access to pot files; disallow access to .bzr, .git, .hg, .svn, .cvs directories; some other comments correction.
1 parent 7b3911c commit e728586

11 files changed

+153
-41
lines changed

apps/drupal/drupal.conf

+35-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,20 @@ location / {
6161
log_not_found off;
6262
}
6363

64-
## Drupal 7 image handling, i.e., imagecache in core. See:
64+
## If accessing an image generated by Drupal 6 imagecache, serve it
65+
## directly if available, if not relay the request to Drupal to (re)generate
66+
## the image.
67+
location ~* /imagecache/ {
68+
## Image hotlinking protection. If you want hotlinking
69+
## protection for your images uncomment the following line.
70+
#include apps/drupal/hotlinking_protection.conf;
71+
72+
access_log off;
73+
expires 30d;
74+
try_files $uri @drupal;
75+
}
76+
77+
## Drupal 7 generated image handling, i.e., imagecache in core. See:
6578
## http://drupal.org/node/371374.
6679
location ~* /files/styles/ {
6780
## Image hotlinking protection. If you want hotlinking
@@ -98,7 +111,7 @@ location / {
98111
}
99112

100113
## All static files will be served directly.
101-
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|html|xml)$ {
114+
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml)$ {
102115
access_log off;
103116
expires 30d;
104117
## No need to bleed constant updates. Send the all shebang in one
@@ -145,7 +158,7 @@ location / {
145158
## Pseudo streaming of FLV files:
146159
## http://wiki.nginx.org/HttpFlvStreamModule.
147160
## If pseudo streaming isn't working, try to comment
148-
## out line 115 in nginx.conf:
161+
## out in nginx.conf line with:
149162
## add_header X-Frame-Options SAMEORIGIN;
150163
location ^~ /sites/default/files/video/flv {
151164
location ~* ^/sites/default/files/video/flv/.*\.flv$ {
@@ -190,7 +203,7 @@ location / {
190203
## Replicate the Apache <FilesMatch> directive of Drupal standard
191204
## .htaccess. Disable access to any code files. Return a 404 to curtail
192205
## information disclosure. Hide also the text files.
193-
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
206+
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
194207
return 404;
195208
}
196209

@@ -222,7 +235,7 @@ location @drupal {
222235

223236
## Filefield Upload progress
224237
## http://drupal.org/project/filefield_nginx_progress support
225-
## through the NgninxUploadProgress modules.
238+
## through the NginxUploadProgress modules.
226239
track_uploads uploads 60s;
227240
}
228241

@@ -247,12 +260,28 @@ location @drupal-no-args {
247260
#include apps/drupal/microcache_proxy_auth.conf;
248261
}
249262

250-
## Disallow access to .git directory: return 404 as not to disclose
263+
## Disallow access to .bzr, .git, .hg, .svn, .cvs directories: return 404 as not to disclose
251264
## information.
265+
location ^~ /.bzr {
266+
return 404;
267+
}
268+
252269
location ^~ /.git {
253270
return 404;
254271
}
255272

273+
location ^~ /.hg {
274+
return 404;
275+
}
276+
277+
location ^~ /.svn {
278+
return 404;
279+
}
280+
281+
location ^~ /.cvs {
282+
return 404;
283+
}
284+
256285
## Disallow access to patches directory.
257286
location ^~ /patches {
258287
return 404;

apps/drupal/drupal_boost.conf

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# -*- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
22
### Nginx configuration for using Boost with Drupal. This
3-
### configuration makes use of drush
4-
### (http:///drupal.org/project/drush) for site maintenance and like
5-
### tasks:
3+
### configuration makes use of drush (http:///drupal.org/project/drush)
4+
### for site maintenance and like tasks:
65
###
76
### 1. Run the cronjobs.
87
### 2. Run the DB and code updates: drush up or drush upc followed by
@@ -62,9 +61,9 @@ location / {
6261
log_not_found off;
6362
}
6463

65-
## If accessing an image generated by imagecache, serve it directly if
66-
## available, if not relay the request to Drupal to (re)generate the
67-
## image.
64+
## If accessing an image generated by Drupal 6 imagecache, serve it
65+
## directly if available, if not relay the request to Drupal to (re)generate
66+
## the image.
6867
location ~* /imagecache/ {
6968
## Image hotlinking protection. If you want hotlinking
7069
## protection for your images uncomment the following line.
@@ -78,6 +77,10 @@ location / {
7877
## Drupal 7 generated image handling, i.e., imagecache in core. See:
7978
## http://drupal.org/node/371374.
8079
location ~* /files/styles/ {
80+
## Image hotlinking protection. If you want hotlinking
81+
## protection for your images uncomment the following line.
82+
#include apps/drupal/hotlinking_protection.conf;
83+
8184
access_log off;
8285
expires 30d;
8386
try_files $uri @drupal;
@@ -108,7 +111,7 @@ location / {
108111
}
109112

110113
## All static files will be served directly.
111-
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|ico|png|html|xml)$ {
114+
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml)$ {
112115
access_log off;
113116
expires 30d;
114117
## No need to bleed constant updates. Send the all shebang in one
@@ -149,6 +152,9 @@ location / {
149152

150153
## Pseudo streaming of FLV files:
151154
## http://wiki.nginx.org/HttpFlvStreamModule.
155+
## If pseudo streaming isn't working, try to comment
156+
## out in nginx.conf line with:
157+
## add_header X-Frame-Options SAMEORIGIN;
152158
location ^~ /sites/default/files/video/flv {
153159
location ~* ^/sites/default/files/video/flv/.*\.flv$ {
154160
flv;
@@ -192,7 +198,7 @@ location / {
192198
## Replicate the Apache <FilesMatch> directive of Drupal standard
193199
## .htaccess. Disable access to any code files. Return a 404 to curtail
194200
## information disclosure. Hide also the text files.
195-
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
201+
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
196202
return 404;
197203
}
198204

@@ -259,7 +265,7 @@ location @drupal {
259265

260266
## Filefield Upload progress
261267
## http://drupal.org/project/filefield_nginx_progress support
262-
## through the NgninxUploadProgress modules.
268+
## through the NginxUploadProgress modules.
263269
track_uploads uploads 60s;
264270
}
265271

@@ -280,12 +286,28 @@ location @drupal-no-args {
280286
#include apps/drupal/microcache_proxy_auth.conf;
281287
}
282288

283-
## Disallow access to .git directory: return 404 as not to disclose
289+
## Disallow access to .bzr, .git, .hg, .svn, .cvs directories: return 404 as not to disclose
284290
## information.
291+
location ^~ /.bzr {
292+
return 404;
293+
}
294+
285295
location ^~ /.git {
286296
return 404;
287297
}
288298

299+
location ^~ /.hg {
300+
return 404;
301+
}
302+
303+
location ^~ /.svn {
304+
return 404;
305+
}
306+
307+
location ^~ /.cvs {
308+
return 404;
309+
}
310+
289311
## Disallow access to patches directory.
290312
location ^~ /patches {
291313
return 404;

apps/drupal/drupal_boost_escaped.conf

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# -*- mode: nginx; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
22
### Nginx configuration for using Boost with Drupal. This
3-
### configuration makes use of drush
4-
### (http:///drupal.org/project/drush) for site maintenance and like
5-
### tasks:
3+
### configuration makes use of drush (http:///drupal.org/project/drush)
4+
### for site maintenance and like tasks:
65
###
76
### 1. Run the cronjobs.
87
### 2. Run the DB and code updates: drush up or drush upc followed by
@@ -65,9 +64,9 @@ location / {
6564
log_not_found off;
6665
}
6766

68-
## If accessing an image generated by imagecache, serve it directly if
69-
## available, if not relay the request to Drupal to (re)generate the
70-
## image.
67+
## If accessing an image generated by Drupal 6 imagecache, serve it
68+
## directly if available, if not relay the request to Drupal to (re)generate
69+
## the image.
7170
location ~* /imagecache/ {
7271
## Image hotlinking protection. If you want hotlinking
7372
## protection for your images uncomment the following line.
@@ -81,6 +80,10 @@ location / {
8180
## Drupal 7 generated image handling, i.e., imagecache in core. See:
8281
## http://drupal.org/node/371374.
8382
location ~* /files/styles/ {
83+
## Image hotlinking protection. If you want hotlinking
84+
## protection for your images uncomment the following line.
85+
#include apps/drupal/hotlinking_protection.conf;
86+
8487
access_log off;
8588
expires 30d;
8689
try_files $escaped_uri @drupal;
@@ -111,7 +114,7 @@ location / {
111114
}
112115

113116
## All static files will be served directly.
114-
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|ico|png|html|xml)$ {
117+
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml)$ {
115118
access_log off;
116119
expires 30d;
117120
## No need to bleed constant updates. Send the all shebang in one
@@ -152,6 +155,9 @@ location / {
152155

153156
## Pseudo streaming of FLV files:
154157
## http://wiki.nginx.org/HttpFlvStreamModule.
158+
## If pseudo streaming isn't working, try to comment
159+
## out in nginx.conf line with:
160+
## add_header X-Frame-Options SAMEORIGIN;
155161
location ^~ /sites/default/files/video/flv {
156162
location ~* ^/sites/default/files/video/flv/.*\.flv$ {
157163
flv;
@@ -195,7 +201,7 @@ location / {
195201
## Replicate the Apache <FilesMatch> directive of Drupal standard
196202
## .htaccess. Disable access to any code files. Return a 404 to curtail
197203
## information disclosure. Hide also the text files.
198-
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
204+
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
199205
return 404;
200206
}
201207

@@ -262,7 +268,7 @@ location @drupal {
262268

263269
## Filefield Upload progress
264270
## http://drupal.org/project/filefield_nginx_progress support
265-
## through the NgninxUploadProgress modules.
271+
## through the NginxUploadProgress modules.
266272
track_uploads uploads 60s;
267273
}
268274

@@ -283,12 +289,28 @@ location @drupal-no-args {
283289
#include apps/drupal/microcache_proxy_auth.conf;
284290
}
285291

286-
## Disallow access to .git directory: return 404 as not to disclose
292+
## Disallow access to .bzr, .git, .hg, .svn, .cvs directories: return 404 as not to disclose
287293
## information.
294+
location ^~ /.bzr {
295+
return 404;
296+
}
297+
288298
location ^~ /.git {
289299
return 404;
290300
}
291301

302+
location ^~ /.hg {
303+
return 404;
304+
}
305+
306+
location ^~ /.svn {
307+
return 404;
308+
}
309+
310+
location ^~ /.cvs {
311+
return 404;
312+
}
313+
292314
## Disallow access to patches directory.
293315
location ^~ /patches {
294316
return 404;

apps/drupal/drupal_escaped.conf

+28-8
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ location / {
6464
log_not_found off;
6565
}
6666

67-
## If accessing an image generated by imagecache, serve it directly if
68-
## available, if not relay the request to Drupal to (re)generate the
69-
## image.
67+
## If accessing an image generated by Drupal 6 imagecache, serve it
68+
## directly if available, if not relay the request to Drupal to (re)generate
69+
## the image.
7070
location ~* /imagecache/ {
7171
## Image hotlinking protection. If you want hotlinking
7272
## protection for your images uncomment the following line.
@@ -80,6 +80,10 @@ location / {
8080
## Drupal 7 generated image handling, i.e., imagecache in core. See:
8181
## http://drupal.org/node/371374.
8282
location ~* /files/styles/ {
83+
## Image hotlinking protection. If you want hotlinking
84+
## protection for your images uncomment the following line.
85+
#include apps/drupal/hotlinking_protection.conf;
86+
8387
access_log off;
8488
expires 30d;
8589
try_files $escaped_uri @drupal;
@@ -110,7 +114,7 @@ location / {
110114
}
111115

112116
## All static files will be served directly.
113-
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|html|xml)$ {
117+
location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml)$ {
114118
access_log off;
115119
expires 30d;
116120
## No need to bleed constant updates. Send the all shebang in one
@@ -157,7 +161,7 @@ location / {
157161
## Pseudo streaming of FLV files:
158162
## http://wiki.nginx.org/HttpFlvStreamModule.
159163
## If pseudo streaming isn't working, try to comment
160-
## out line 115 in nginx.conf:
164+
## out in nginx.conf line with:
161165
## add_header X-Frame-Options SAMEORIGIN;
162166
location ^~ /sites/default/files/video/flv {
163167
location ~* ^/sites/default/files/video/flv/.*\.flv$ {
@@ -202,7 +206,7 @@ location / {
202206
## Replicate the Apache <FilesMatch> directive of Drupal standard
203207
## .htaccess. Disable access to any code files. Return a 404 to curtail
204208
## information disclosure. Hide also the text files.
205-
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
209+
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
206210
return 404;
207211
}
208212

@@ -234,7 +238,7 @@ location @drupal {
234238

235239
## Filefield Upload progress
236240
## http://drupal.org/project/filefield_nginx_progress support
237-
## through the NgninxUploadProgress modules.
241+
## through the NginxUploadProgress modules.
238242
track_uploads uploads 60s;
239243
}
240244

@@ -259,12 +263,28 @@ location @drupal-no-args {
259263
#include apps/drupal/microcache_proxy_auth.conf;
260264
}
261265

262-
## Disallow access to .git directory: return 404 as not to disclose
266+
## Disallow access to .bzr, .git, .hg, .svn, .cvs directories: return 404 as not to disclose
263267
## information.
268+
location ^~ /.bzr {
269+
return 404;
270+
}
271+
264272
location ^~ /.git {
265273
return 404;
266274
}
267275

276+
location ^~ /.hg {
277+
return 404;
278+
}
279+
280+
location ^~ /.svn {
281+
return 404;
282+
}
283+
284+
location ^~ /.cvs {
285+
return 404;
286+
}
287+
268288
## Disallow access to patches directory.
269289
location ^~ /patches {
270290
return 404;

apps/drupal/microcache_fcgi.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ expires epoch;
3636
#fastcgi_cache_lock on;
3737
## The default timeout, i.e., the time to way before forwarding the
3838
## second request upstream if no reply as arrived in the meantime is 5s.
39-
# fastcgi_cache_lock_timeout 8000; # in miliseconds.
39+
#fastcgi_cache_lock_timeout 8000; # in miliseconds.

apps/drupal/microcache_fcgi_auth.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ expires epoch;
3434
#fastcgi_cache_lock on;
3535
## The default timeout, i.e., the time to way before forwarding the
3636
## second request upstream if no reply as arrived in the meantime is 5s.
37-
# fastcgi_cache_lock_timeout 8000; # in miliseconds.
37+
#fastcgi_cache_lock_timeout 8000; # in miliseconds.

koi-win

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
charset_map koi8-r windows-1251 {
32

43
80 88 ; # euro

0 commit comments

Comments
 (0)