1 yhager's nginx Drupal config:
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.
8 This is a complete nginx configuration that is meant to serve as a
16 * Drupal with clean URL's (of course!)
18 * Multisite - to add a site, just create a short config file and
21 * Multiple environments - like staging, development and production
22 are possible (see example config file)
24 * Images server for static files and imagecache manipulation (You
25 would want to override theme_imagecache for this).
27 * Boost[2] supported - if boost files exist they are used (Boost 5.x
30 * Gzipped static files are served if they exist (see tne javascript
31 aggregator module[3]).
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.
37 * Large fastcgi timeout - to allow long opeartions to run on PHP,
40 * Use http://localhost/nginx_status to monitor server health, with
43 [2] http://drupal.org/project/boost
44 [3] http://drupal.org/project/javascript_aggregator
49 These same settings and instructions would also work for mediawiki
50 based wiki site. It can be extended to support more platforms (like
57 git clone git://github.com/yhager/nginx_drupal
59 # point nginx conf file to nginx.conf
60 vi /etc/init.d/nginx # your distro might have different location
62 # restart nginx (distro dependant)
63 /etc/init.d/nginx restart
65 # make sure you have a php-cgi server running on port 3000
66 php-cgi -b 127.0.0.1:3000
68 # create a config file for your site
69 cp conf/vhosts.d/{example,yoursite}.conf
70 vi conf/vhosts.d/yoursite.conf
72 # edit conf/production, conf/staging and conf/dev to point to the directory of each env.
73 vi conf/{production,staging,dev}
76 * Running update.php and other protected PHP files
78 The supplied htaccess uses the user 'user' and the password
79 'secret'. Be sure to change that using the 'htpasswd' command:
81 htpasswd -c -b conf/htpasswd user secret
86 # Copy conf/example.conf and edit it
87 cp conf/vhosts.d/{example,anothersite}.conf
88 vi conf/vhosts.d/anothersite.conf
91 /etc/init.d/nginx reload
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.
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.
107 Fork this project on GitHub and send pull requests.
110 Bugs, Features, Issues:
112 File a report on the issue tracker:
113 http://github.com/yhager/nginx_drupal/issues/
118 Send me an e-mail (see LICENSE for my address).