├── .gitignore ├── LICENSE ├── README └── conf ├── dev ├── drupal ├── drupal_common ├── fastcgi ├── fastcgi_params ├── fastcgi_params.default ├── htpasswd ├── imagecache ├── koi-utf ├── koi-win ├── mime.types ├── mime.types.default ├── nginx.conf ├── nginx_status ├── production ├── staging ├── vhosts.d └── example.conf └── win-utf /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License: 2 | 3 | Copyright (c) 2010, Yuval Hager 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | yhager's nginx Drupal config: 2 | 3 | This is a complete nginx configuration for Drupal[1] sites. It 4 | supports boost, images server and multiple sites. Configuration of 5 | generic components is encapsulated, so you only need to define the 6 | required stuff, like domain name, web root directory etc. 7 | 8 | This is a complete nginx configuration that is meant to serve as a 9 | basis for your setup. 10 | 11 | [1] http://drupal.org 12 | 13 | 14 | Features: 15 | 16 | * Drupal with clean URL's (of course!) 17 | 18 | * Multisite - to add a site, just create a short config file and 19 | reload 20 | 21 | * Multiple environments - like staging, development and production 22 | are possible (see example config file) 23 | 24 | * Images server for static files and imagecache manipulation (You 25 | would want to override theme_imagecache for this). 26 | 27 | * Boost[2] supported - if boost files exist they are used (Boost 5.x 28 | files scheme) 29 | 30 | * Gzipped static files are served if they exist (see tne javascript 31 | aggregator module[3]). 32 | 33 | * Only allows to run the required PHP files (index.php, 34 | cron.php). The rest require a htpasswd. This provides a level of 35 | protection that is missing from most Drupal installations. 36 | 37 | * Large fastcgi timeout - to allow long opeartions to run on PHP, 38 | until PHP times out. 39 | 40 | * Use http://localhost/nginx_status to monitor server health, with 41 | tools like munin. 42 | 43 | [2] http://drupal.org/project/boost 44 | [3] http://drupal.org/project/javascript_aggregator 45 | 46 | 47 | Note: 48 | 49 | These same settings and instructions would also work for mediawiki 50 | based wiki site. It can be extended to support more platforms (like 51 | wordpress). 52 | 53 | 54 | Installation: 55 | 56 | # clone 57 | git clone git://github.com/yhager/nginx_drupal 58 | 59 | # point nginx conf file to nginx.conf 60 | vi /etc/init.d/nginx # your distro might have different location 61 | 62 | # restart nginx (distro dependant) 63 | /etc/init.d/nginx restart 64 | 65 | # make sure you have a php-cgi server running on port 3000 66 | php-cgi -b 127.0.0.1:3000 67 | 68 | # create a config file for your site 69 | cp conf/vhosts.d/{example,yoursite}.conf 70 | vi conf/vhosts.d/yoursite.conf 71 | 72 | # edit conf/production, conf/staging and conf/dev to point to the directory of each env. 73 | vi conf/{production,staging,dev} 74 | 75 | 76 | * Running update.php and other protected PHP files 77 | 78 | The supplied htaccess uses the user 'user' and the password 79 | 'secret'. Be sure to change that using the 'htpasswd' command: 80 | 81 | htpasswd -c -b conf/htpasswd user secret 82 | 83 | 84 | * Adding another site 85 | 86 | # Copy conf/example.conf and edit it 87 | cp conf/vhosts.d/{example,anothersite}.conf 88 | vi conf/vhosts.d/anothersite.conf 89 | 90 | # reload nginx 91 | /etc/init.d/nginx reload 92 | 93 | 94 | Troubleshooting: 95 | 96 | If you get an error about gzip_static line, either comment it out 97 | (and lose the automatic .gz files match) or recompile nginx with the 98 | '--with-http_gzip_static_module' configuration option. 99 | 100 | If you get an error about stub_status module missing, comment those 101 | lines out, or recompile nginx with '--with-http_stub_status_module' 102 | configuration option. 103 | 104 | 105 | Contribution: 106 | 107 | Fork this project on GitHub and send pull requests. 108 | 109 | 110 | Bugs, Features, Issues: 111 | 112 | File a report on the issue tracker: 113 | http://github.com/yhager/nginx_drupal/issues/ 114 | 115 | 116 | Questions: 117 | 118 | Send me an e-mail (see LICENSE for my address). 119 | -------------------------------------------------------------------------------- /conf/dev: -------------------------------------------------------------------------------- 1 | root /var/www/html/dev; 2 | -------------------------------------------------------------------------------- /conf/drupal: -------------------------------------------------------------------------------- 1 | include drupal_common; 2 | 3 | location / { 4 | try_files $uri @cache; 5 | } 6 | 7 | # This will try to see if we have a boost file in place. no harm done if this is not used 8 | location @cache { 9 | # queries, drupal cookies, or not GET methods, all require PHP processing. 10 | if ($query_string ~ ".+") { 11 | return 405; 12 | } 13 | if ($http_cookie ~ "DRUPAL_UID" ) { 14 | return 405; 15 | } 16 | if ($request_method !~ ^(GET|HEAD)$ ) { 17 | return 405; 18 | } 19 | error_page 405 = @drupal; 20 | 21 | # Drupal uses 1978 - I am 4 years older than Dries :) 22 | add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT"; 23 | add_header Cache-Control "must-revalidate, post-check=0, pre-check=0"; 24 | try_files /cache/normal/$host/${uri}_.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal; 25 | } 26 | 27 | # only a few php files are allowed, this increases the overall server security 28 | location ~* ^/(index|boost_stats|cron|xmlrpc).php$ { 29 | include fastcgi; 30 | } 31 | 32 | # internal pages are protected with a simple htpasswd 33 | location ~* ^/(install|update|memcached|apc|info).php$ { 34 | auth_basic "Restricted Area"; 35 | auth_basic_user_file htpasswd; 36 | include fastcgi; 37 | } 38 | 39 | location ~* ^.+\.php$ { 40 | return 404; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /conf/drupal_common: -------------------------------------------------------------------------------- 1 | charset utf-8; 2 | 3 | # search for already compressed files 4 | gzip_static on; 5 | gzip on; 6 | 7 | # some images have no mime type 8 | default_type image/jpeg; 9 | 10 | # Buffers definition. allows of up to 260k to be passed in memory. 11 | client_body_buffer_size 1m; 12 | proxy_buffering on; 13 | proxy_buffer_size 4k; 14 | proxy_buffers 8 32k; 15 | 16 | # 404 generated from php can be rather slow. Uncomment with care 17 | #error_page 404 /index.php; 18 | 19 | # disallow access to version control directory, but return 404, not to disclose information 20 | location /.git { 21 | return 404; 22 | } 23 | 24 | # robots.txt is important for search engines 25 | location /robots.txt { 26 | access_log off; 27 | } 28 | 29 | # This is mostly based on Drupal's stock .htaccess 30 | location ~* ^.+(\.(txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ { 31 | return 404; 32 | } 33 | 34 | # serve imagecache files directly or redirect to drupal if they do not exist 35 | location ~* imagecache { 36 | access_log off; 37 | expires 30d; 38 | try_files $uri @drupal; 39 | } 40 | 41 | # Drupal 7 image stylef 42 | location ~* image/generate { 43 | access_log off; 44 | expires 30d; 45 | try_files $uri @drupal; 46 | } 47 | 48 | # serve static files directly 49 | location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|swf|flv)$ { 50 | access_log off; 51 | expires 30d; 52 | } 53 | 54 | # This rewrites pages to be sent to PHP processing 55 | location @drupal { 56 | index index.php; 57 | if (!-e $request_filename) { 58 | rewrite ^/(.*)$ /index.php?q=$1 last; 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /conf/fastcgi: -------------------------------------------------------------------------------- 1 | # Use your own port of fastcgi here 2 | fastcgi_pass 127.0.0.1:3000; 3 | fastcgi_index index.php; 4 | include fastcgi_params; 5 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 6 | -------------------------------------------------------------------------------- /conf/fastcgi_params: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_read_timeout 14400; # allow 4 hrs - pass timeo responsibility to upstream 3 | 4 | fastcgi_param QUERY_STRING $query_string; 5 | fastcgi_param REQUEST_METHOD $request_method; 6 | fastcgi_param CONTENT_TYPE $content_type; 7 | fastcgi_param CONTENT_LENGTH $content_length; 8 | 9 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 10 | fastcgi_param REQUEST_URI $request_uri; 11 | fastcgi_param DOCUMENT_URI $document_uri; 12 | fastcgi_param DOCUMENT_ROOT $document_root; 13 | fastcgi_param SERVER_PROTOCOL $server_protocol; 14 | 15 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 16 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 17 | 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | 24 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 25 | fastcgi_param REDIRECT_STATUS 200; 26 | -------------------------------------------------------------------------------- /conf/fastcgi_params.default: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_param QUERY_STRING $query_string; 3 | fastcgi_param REQUEST_METHOD $request_method; 4 | fastcgi_param CONTENT_TYPE $content_type; 5 | fastcgi_param CONTENT_LENGTH $content_length; 6 | 7 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 8 | fastcgi_param REQUEST_URI $request_uri; 9 | fastcgi_param DOCUMENT_URI $document_uri; 10 | fastcgi_param DOCUMENT_ROOT $document_root; 11 | fastcgi_param SERVER_PROTOCOL $server_protocol; 12 | 13 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 14 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 15 | 16 | fastcgi_param REMOTE_ADDR $remote_addr; 17 | fastcgi_param REMOTE_PORT $remote_port; 18 | fastcgi_param SERVER_ADDR $server_addr; 19 | fastcgi_param SERVER_PORT $server_port; 20 | fastcgi_param SERVER_NAME $server_name; 21 | 22 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 23 | fastcgi_param REDIRECT_STATUS 200; 24 | -------------------------------------------------------------------------------- /conf/htpasswd: -------------------------------------------------------------------------------- 1 | user:OgdL02x81onBc 2 | -------------------------------------------------------------------------------- /conf/imagecache: -------------------------------------------------------------------------------- 1 | include drupal_common; 2 | 3 | location = /index.php { 4 | if ($arg_q !~ files/imagecache) { 5 | return 403; 6 | } 7 | include fastcgi; 8 | } 9 | 10 | location ~* ^/(apc|info).php$ { 11 | auth_basic "Restricted Area"; 12 | auth_basic_user_file htpasswd; 13 | include fastcgi; 14 | } 15 | 16 | location ~* ^.+\.php$ { 17 | return 404; 18 | } 19 | 20 | error_page 404 = @empty; 21 | 22 | location @empty { 23 | empty_gif; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /conf/koi-utf: -------------------------------------------------------------------------------- 1 | 2 | # This map is not a full koi8-r <> utf8 map: it does not contain 3 | # box-drawing and some other characters. Besides this map contains 4 | # several koi8-u and Byelorussian letters which are not in koi8-r. 5 | # If you need a full and standard map, use contrib/unicode2nginx/koi-utf 6 | # map instead. 7 | 8 | charset_map koi8-r utf-8 { 9 | 10 | 80 E282AC ; # euro 11 | 12 | 95 E280A2 ; # bullet 13 | 14 | 9A C2A0 ; #   15 | 16 | 9E C2B7 ; # · 17 | 18 | A3 D191 ; # small yo 19 | A4 D194 ; # small Ukrainian ye 20 | 21 | A6 D196 ; # small Ukrainian i 22 | A7 D197 ; # small Ukrainian yi 23 | 24 | AD D291 ; # small Ukrainian soft g 25 | AE D19E ; # small Byelorussian short u 26 | 27 | B0 C2B0 ; # ° 28 | 29 | B3 D081 ; # capital YO 30 | B4 D084 ; # capital Ukrainian YE 31 | 32 | B6 D086 ; # capital Ukrainian I 33 | B7 D087 ; # capital Ukrainian YI 34 | 35 | B9 E28496 ; # numero sign 36 | 37 | BD D290 ; # capital Ukrainian soft G 38 | BE D18E ; # capital Byelorussian short U 39 | 40 | BF C2A9 ; # (C) 41 | 42 | C0 D18E ; # small yu 43 | C1 D0B0 ; # small a 44 | C2 D0B1 ; # small b 45 | C3 D186 ; # small ts 46 | C4 D0B4 ; # small d 47 | C5 D0B5 ; # small ye 48 | C6 D184 ; # small f 49 | C7 D0B3 ; # small g 50 | C8 D185 ; # small kh 51 | C9 D0B8 ; # small i 52 | CA D0B9 ; # small j 53 | CB D0BA ; # small k 54 | CC D0BB ; # small l 55 | CD D0BC ; # small m 56 | CE D0BD ; # small n 57 | CF D0BE ; # small o 58 | 59 | D0 D0BF ; # small p 60 | D1 D18F ; # small ya 61 | D2 D180 ; # small r 62 | D3 D181 ; # small s 63 | D4 D182 ; # small t 64 | D5 D183 ; # small u 65 | D6 D0B6 ; # small zh 66 | D7 D0B2 ; # small v 67 | D8 D18C ; # small soft sign 68 | D9 D18B ; # small y 69 | DA D0B7 ; # small z 70 | DB D188 ; # small sh 71 | DC D18D ; # small e 72 | DD D189 ; # small shch 73 | DE D187 ; # small ch 74 | DF D18A ; # small hard sign 75 | 76 | E0 D0AE ; # capital YU 77 | E1 D090 ; # capital A 78 | E2 D091 ; # capital B 79 | E3 D0A6 ; # capital TS 80 | E4 D094 ; # capital D 81 | E5 D095 ; # capital YE 82 | E6 D0A4 ; # capital F 83 | E7 D093 ; # capital G 84 | E8 D0A5 ; # capital KH 85 | E9 D098 ; # capital I 86 | EA D099 ; # capital J 87 | EB D09A ; # capital K 88 | EC D09B ; # capital L 89 | ED D09C ; # capital M 90 | EE D09D ; # capital N 91 | EF D09E ; # capital O 92 | 93 | F0 D09F ; # capital P 94 | F1 D0AF ; # capital YA 95 | F2 D0A0 ; # capital R 96 | F3 D0A1 ; # capital S 97 | F4 D0A2 ; # capital T 98 | F5 D0A3 ; # capital U 99 | F6 D096 ; # capital ZH 100 | F7 D092 ; # capital V 101 | F8 D0AC ; # capital soft sign 102 | F9 D0AB ; # capital Y 103 | FA D097 ; # capital Z 104 | FB D0A8 ; # capital SH 105 | FC D0AD ; # capital E 106 | FD D0A9 ; # capital SHCH 107 | FE D0A7 ; # capital CH 108 | FF D0AA ; # capital hard sign 109 | } 110 | -------------------------------------------------------------------------------- /conf/koi-win: -------------------------------------------------------------------------------- 1 | 2 | charset_map koi8-r windows-1251 { 3 | 4 | 80 88 ; # euro 5 | 6 | 95 95 ; # bullet 7 | 8 | 9A A0 ; #   9 | 10 | 9E B7 ; # · 11 | 12 | A3 B8 ; # small yo 13 | A4 BA ; # small Ukrainian ye 14 | 15 | A6 B3 ; # small Ukrainian i 16 | A7 BF ; # small Ukrainian yi 17 | 18 | AD B4 ; # small Ukrainian soft g 19 | AE A2 ; # small Byelorussian short u 20 | 21 | B0 B0 ; # ° 22 | 23 | B3 A8 ; # capital YO 24 | B4 AA ; # capital Ukrainian YE 25 | 26 | B6 B2 ; # capital Ukrainian I 27 | B7 AF ; # capital Ukrainian YI 28 | 29 | B9 B9 ; # numero sign 30 | 31 | BD A5 ; # capital Ukrainian soft G 32 | BE A1 ; # capital Byelorussian short U 33 | 34 | BF A9 ; # (C) 35 | 36 | C0 FE ; # small yu 37 | C1 E0 ; # small a 38 | C2 E1 ; # small b 39 | C3 F6 ; # small ts 40 | C4 E4 ; # small d 41 | C5 E5 ; # small ye 42 | C6 F4 ; # small f 43 | C7 E3 ; # small g 44 | C8 F5 ; # small kh 45 | C9 E8 ; # small i 46 | CA E9 ; # small j 47 | CB EA ; # small k 48 | CC EB ; # small l 49 | CD EC ; # small m 50 | CE ED ; # small n 51 | CF EE ; # small o 52 | 53 | D0 EF ; # small p 54 | D1 FF ; # small ya 55 | D2 F0 ; # small r 56 | D3 F1 ; # small s 57 | D4 F2 ; # small t 58 | D5 F3 ; # small u 59 | D6 E6 ; # small zh 60 | D7 E2 ; # small v 61 | D8 FC ; # small soft sign 62 | D9 FB ; # small y 63 | DA E7 ; # small z 64 | DB F8 ; # small sh 65 | DC FD ; # small e 66 | DD F9 ; # small shch 67 | DE F7 ; # small ch 68 | DF FA ; # small hard sign 69 | 70 | E0 DE ; # capital YU 71 | E1 C0 ; # capital A 72 | E2 C1 ; # capital B 73 | E3 D6 ; # capital TS 74 | E4 C4 ; # capital D 75 | E5 C5 ; # capital YE 76 | E6 D4 ; # capital F 77 | E7 C3 ; # capital G 78 | E8 D5 ; # capital KH 79 | E9 C8 ; # capital I 80 | EA C9 ; # capital J 81 | EB CA ; # capital K 82 | EC CB ; # capital L 83 | ED CC ; # capital M 84 | EE CD ; # capital N 85 | EF CE ; # capital O 86 | 87 | F0 CF ; # capital P 88 | F1 DF ; # capital YA 89 | F2 D0 ; # capital R 90 | F3 D1 ; # capital S 91 | F4 D2 ; # capital T 92 | F5 D3 ; # capital U 93 | F6 C6 ; # capital ZH 94 | F7 C2 ; # capital V 95 | F8 DC ; # capital soft sign 96 | F9 DB ; # capital Y 97 | FA C7 ; # capital Z 98 | FB D8 ; # capital SH 99 | FC DD ; # capital E 100 | FD D9 ; # capital SHCH 101 | FE D7 ; # capital CH 102 | FF DA ; # capital hard sign 103 | } 104 | -------------------------------------------------------------------------------- /conf/mime.types: -------------------------------------------------------------------------------- 1 | 2 | types { 3 | text/html html htm shtml; 4 | text/css css; 5 | text/xml xml; 6 | image/gif gif; 7 | image/jpeg jpeg jpg; 8 | application/x-javascript js; 9 | application/atom+xml atom; 10 | application/rss+xml rss; 11 | 12 | text/mathml mml; 13 | text/plain txt; 14 | text/vnd.sun.j2me.app-descriptor jad; 15 | text/vnd.wap.wml wml; 16 | text/x-component htc; 17 | 18 | image/png png; 19 | image/tiff tif tiff; 20 | image/vnd.wap.wbmp wbmp; 21 | image/x-icon ico; 22 | image/x-jng jng; 23 | image/x-ms-bmp bmp; 24 | image/svg+xml svg; 25 | 26 | application/java-archive jar war ear; 27 | application/mac-binhex40 hqx; 28 | application/msword doc; 29 | application/pdf pdf; 30 | application/postscript ps eps ai; 31 | application/rtf rtf; 32 | application/vnd.ms-excel xls; 33 | application/vnd.ms-powerpoint ppt; 34 | application/vnd.wap.wmlc wmlc; 35 | application/vnd.wap.xhtml+xml xhtml; 36 | application/vnd.google-earth.kml+xml kml; 37 | application/vnd.google-earth.kmz kmz; 38 | application/x-cocoa cco; 39 | application/x-java-archive-diff jardiff; 40 | application/x-java-jnlp-file jnlp; 41 | application/x-makeself run; 42 | application/x-perl pl pm; 43 | application/x-pilot prc pdb; 44 | application/x-rar-compressed rar; 45 | application/x-redhat-package-manager rpm; 46 | application/x-sea sea; 47 | application/x-shockwave-flash swf; 48 | application/x-stuffit sit; 49 | application/x-tcl tcl tk; 50 | application/x-x509-ca-cert der pem crt; 51 | application/x-xpinstall xpi; 52 | application/zip zip; 53 | 54 | application/octet-stream bin exe dll; 55 | application/octet-stream deb; 56 | application/octet-stream dmg; 57 | application/octet-stream eot; 58 | application/octet-stream iso img; 59 | application/octet-stream msi msp msm; 60 | 61 | audio/midi mid midi kar; 62 | audio/mpeg mp3; 63 | audio/x-realaudio ra; 64 | 65 | video/3gpp 3gpp 3gp; 66 | video/mpeg mpeg mpg; 67 | video/quicktime mov; 68 | video/x-flv flv; 69 | video/x-mng mng; 70 | video/x-ms-asf asx asf; 71 | video/x-ms-wmv wmv; 72 | video/x-msvideo avi; 73 | } 74 | -------------------------------------------------------------------------------- /conf/mime.types.default: -------------------------------------------------------------------------------- 1 | 2 | types { 3 | text/html html htm shtml; 4 | text/css css; 5 | text/xml xml; 6 | image/gif gif; 7 | image/jpeg jpeg jpg; 8 | application/x-javascript js; 9 | application/atom+xml atom; 10 | application/rss+xml rss; 11 | 12 | text/mathml mml; 13 | text/plain txt; 14 | text/vnd.sun.j2me.app-descriptor jad; 15 | text/vnd.wap.wml wml; 16 | text/x-component htc; 17 | 18 | image/png png; 19 | image/tiff tif tiff; 20 | image/vnd.wap.wbmp wbmp; 21 | image/x-icon ico; 22 | image/x-jng jng; 23 | image/x-ms-bmp bmp; 24 | image/svg+xml svg; 25 | 26 | application/java-archive jar war ear; 27 | application/mac-binhex40 hqx; 28 | application/msword doc; 29 | application/pdf pdf; 30 | application/postscript ps eps ai; 31 | application/rtf rtf; 32 | application/vnd.ms-excel xls; 33 | application/vnd.ms-powerpoint ppt; 34 | application/vnd.wap.wmlc wmlc; 35 | application/vnd.wap.xhtml+xml xhtml; 36 | application/vnd.google-earth.kml+xml kml; 37 | application/vnd.google-earth.kmz kmz; 38 | application/x-cocoa cco; 39 | application/x-java-archive-diff jardiff; 40 | application/x-java-jnlp-file jnlp; 41 | application/x-makeself run; 42 | application/x-perl pl pm; 43 | application/x-pilot prc pdb; 44 | application/x-rar-compressed rar; 45 | application/x-redhat-package-manager rpm; 46 | application/x-sea sea; 47 | application/x-shockwave-flash swf; 48 | application/x-stuffit sit; 49 | application/x-tcl tcl tk; 50 | application/x-x509-ca-cert der pem crt; 51 | application/x-xpinstall xpi; 52 | application/zip zip; 53 | 54 | application/octet-stream bin exe dll; 55 | application/octet-stream deb; 56 | application/octet-stream dmg; 57 | application/octet-stream eot; 58 | application/octet-stream iso img; 59 | application/octet-stream msi msp msm; 60 | 61 | audio/midi mid midi kar; 62 | audio/mpeg mp3; 63 | audio/x-realaudio ra; 64 | 65 | video/3gpp 3gpp 3gp; 66 | video/mpeg mpeg mpg; 67 | video/quicktime mov; 68 | video/x-flv flv; 69 | video/x-mng mng; 70 | video/x-ms-asf asx asf; 71 | video/x-ms-wmv wmv; 72 | video/x-msvideo avi; 73 | } 74 | -------------------------------------------------------------------------------- /conf/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | #user nobody; 3 | user nginx; 4 | worker_processes 4; 5 | 6 | error_log /var/log/nginx/error.log warn; 7 | #error_log logs/error.log notice; 8 | #error_log logs/error.log info; 9 | 10 | #pid logs/nginx.pid; 11 | 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | 18 | http { 19 | include mime.types; 20 | default_type application/octet-stream; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | #access_log logs/access.log main; 27 | 28 | sendfile on; 29 | #tcp_nopush on; 30 | 31 | #keepalive_timeout 0; 32 | keepalive_timeout 65; 33 | 34 | # if client sends stuff larger than this, it gets 413 error 35 | client_max_body_size 10m; 36 | 37 | gzip on; 38 | 39 | server { 40 | listen 80; 41 | server_name localhost; 42 | 43 | charset utf-8; 44 | 45 | #access_log logs/host.access.log main; 46 | 47 | location / { 48 | root html; 49 | #index index.html index.htm; 50 | index ok.html; 51 | } 52 | 53 | #error_page 404 /404.html; 54 | 55 | # redirect server error pages to the static page /50x.html 56 | # 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | root html; 60 | } 61 | 62 | } 63 | 64 | 65 | include vhosts.d/*.conf; 66 | } 67 | -------------------------------------------------------------------------------- /conf/nginx_status: -------------------------------------------------------------------------------- 1 | location /nginx_status { 2 | auth_basic "Restricted Area"; 3 | auth_basic_user_file htpasswd; 4 | 5 | stub_status on; 6 | access_log off; 7 | allow 127.0.0.1; 8 | # Add IP adresses you want to allow 9 | # allow n.n.n.n; 10 | deny all; 11 | } 12 | -------------------------------------------------------------------------------- /conf/production: -------------------------------------------------------------------------------- 1 | root /var/www/html/production; 2 | -------------------------------------------------------------------------------- /conf/staging: -------------------------------------------------------------------------------- 1 | root /var/www/html/staging; 2 | -------------------------------------------------------------------------------- /conf/vhosts.d/example.conf: -------------------------------------------------------------------------------- 1 | # main production site 2 | server { 3 | server_name www.example.com; 4 | access_log /var/log/nginx/example.access.log main; 5 | error_log /var/log/nginx/example.error.log warn; 6 | include production; 7 | include drupal; 8 | include nginx_status; 9 | } 10 | 11 | # redirect if not using www 12 | server { 13 | server_name example.com; 14 | rewrite ^(.+)$ http://www.$host$1 permanent; 15 | } 16 | 17 | # just resize and serve images and static files 18 | server { 19 | server_name images.example.com; 20 | access_log /var/log/nginx/images.access.log main; 21 | error_log /var/log/nginx/images.error.log warn; 22 | include production; 23 | include imagecache; 24 | include nginx_status; 25 | } 26 | 27 | # staging site 28 | server { 29 | server_name .staging.example.com; 30 | access_log /var/log/nginx/staging.access.log main; 31 | error_log /var/log/nginx/staging.error.log warn; 32 | include staging; 33 | include drupal; 34 | include nginx_status; 35 | } 36 | 37 | # development site 38 | server { 39 | server_name .dev.example.com; 40 | access_log /var/log/nginx/dev.access.log main; 41 | error_log /var/log/nginx/dev.error.log warn; 42 | include dev; 43 | include drupal; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /conf/win-utf: -------------------------------------------------------------------------------- 1 | 2 | # This map is not a full windows-1251 <> utf8 map: it does not 3 | # contain Serbian and Macedonian letters. If you need a full map, 4 | # use contrib/unicode2nginx/win-utf map instead. 5 | 6 | charset_map windows-1251 utf-8 { 7 | 8 | 82 E2809A ; # single low-9 quotation mark 9 | 10 | 84 E2809E ; # double low-9 quotation mark 11 | 85 E280A6 ; # ellipsis 12 | 86 E280A0 ; # dagger 13 | 87 E280A1 ; # double dagger 14 | 88 E282AC ; # euro 15 | 89 E280B0 ; # per mille 16 | 17 | 91 E28098 ; # left single quotation mark 18 | 92 E28099 ; # right single quotation mark 19 | 93 E2809C ; # left double quotation mark 20 | 94 E2809D ; # right double quotation mark 21 | 95 E280A2 ; # bullet 22 | 96 E28093 ; # en dash 23 | 97 E28094 ; # em dash 24 | 25 | 99 E284A2 ; # trade mark sign 26 | 27 | A0 C2A0 ; #   28 | A1 D18E ; # capital Byelorussian short U 29 | A2 D19E ; # small Byelorussian short u 30 | 31 | A4 C2A4 ; # currency sign 32 | A5 D290 ; # capital Ukrainian soft G 33 | A6 C2A6 ; # borken bar 34 | A7 C2A7 ; # section sign 35 | A8 D081 ; # capital YO 36 | A9 C2A9 ; # (C) 37 | AA D084 ; # capital Ukrainian YE 38 | AB C2AB ; # left-pointing double angle quotation mark 39 | AC C2AC ; # not sign 40 | AD C2AD ; # soft hypen 41 | AE C2AE ; # (R) 42 | AF D087 ; # capital Ukrainian YI 43 | 44 | B0 C2B0 ; # ° 45 | B1 C2B1 ; # plus-minus sign 46 | B2 D086 ; # capital Ukrainian I 47 | B3 D196 ; # small Ukrainian i 48 | B4 D291 ; # small Ukrainian soft g 49 | B5 C2B5 ; # micro sign 50 | B6 C2B6 ; # pilcrow sign 51 | B7 C2B7 ; # · 52 | B8 D191 ; # small yo 53 | B9 E28496 ; # numero sign 54 | BA D194 ; # small Ukrainian ye 55 | BB C2BB ; # right-pointing double angle quotation mark 56 | 57 | BF D197 ; # small Ukrainian yi 58 | 59 | C0 D090 ; # capital A 60 | C1 D091 ; # capital B 61 | C2 D092 ; # capital V 62 | C3 D093 ; # capital G 63 | C4 D094 ; # capital D 64 | C5 D095 ; # capital YE 65 | C6 D096 ; # capital ZH 66 | C7 D097 ; # capital Z 67 | C8 D098 ; # capital I 68 | C9 D099 ; # capital J 69 | CA D09A ; # capital K 70 | CB D09B ; # capital L 71 | CC D09C ; # capital M 72 | CD D09D ; # capital N 73 | CE D09E ; # capital O 74 | CF D09F ; # capital P 75 | 76 | D0 D0A0 ; # capital R 77 | D1 D0A1 ; # capital S 78 | D2 D0A2 ; # capital T 79 | D3 D0A3 ; # capital U 80 | D4 D0A4 ; # capital F 81 | D5 D0A5 ; # capital KH 82 | D6 D0A6 ; # capital TS 83 | D7 D0A7 ; # capital CH 84 | D8 D0A8 ; # capital SH 85 | D9 D0A9 ; # capital SHCH 86 | DA D0AA ; # capital hard sign 87 | DB D0AB ; # capital Y 88 | DC D0AC ; # capital soft sign 89 | DD D0AD ; # capital E 90 | DE D0AE ; # capital YU 91 | DF D0AF ; # capital YA 92 | 93 | E0 D0B0 ; # small a 94 | E1 D0B1 ; # small b 95 | E2 D0B2 ; # small v 96 | E3 D0B3 ; # small g 97 | E4 D0B4 ; # small d 98 | E5 D0B5 ; # small ye 99 | E6 D0B6 ; # small zh 100 | E7 D0B7 ; # small z 101 | E8 D0B8 ; # small i 102 | E9 D0B9 ; # small j 103 | EA D0BA ; # small k 104 | EB D0BB ; # small l 105 | EC D0BC ; # small m 106 | ED D0BD ; # small n 107 | EE D0BE ; # small o 108 | EF D0BF ; # small p 109 | 110 | F0 D180 ; # small r 111 | F1 D181 ; # small s 112 | F2 D182 ; # small t 113 | F3 D183 ; # small u 114 | F4 D184 ; # small f 115 | F5 D185 ; # small kh 116 | F6 D186 ; # small ts 117 | F7 D187 ; # small ch 118 | F8 D188 ; # small sh 119 | F9 D189 ; # small shch 120 | FA D18A ; # small hard sign 121 | FB D18B ; # small y 122 | FC D18C ; # small soft sign 123 | FD D18D ; # small e 124 | FE D18E ; # small yu 125 | FF D18F ; # small ya 126 | } 127 | --------------------------------------------------------------------------------