Need help with nginx_drupal?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

126 Stars 18 Forks ISC License 21 Commits 2 Opened issues


nginx configuration for use with Drupal - supports boost, multisite, static image servers and multiple environments

Services available


Need anything else?

Contributors list

# 185,674
20 commits

yhager's nginx Drupal config:

This is a complete nginx configuration for Drupal[1] sites. It supports boost, images server and multiple sites. Configuration of generic components is encapsulated, so you only need to define the required stuff, like domain name, web root directory etc.

This is a complete nginx configuration that is meant to serve as a basis for your setup.



  • Drupal with clean URL's (of course!)

  • Multisite - to add a site, just create a short config file and reload

  • Multiple environments - like staging, development and production are possible (see example config file)

  • Images server for static files and imagecache manipulation (You would want to override theme_imagecache for this).

  • Boost[2] supported - if boost files exist they are used (Boost 5.x files scheme)

  • Gzipped static files are served if they exist (see tne javascript aggregator module[3]).

  • Only allows to run the required PHP files (index.php, cron.php). The rest require a htpasswd. This provides a level of protection that is missing from most Drupal installations.

  • Large fastcgi timeout - to allow long opeartions to run on PHP, until PHP times out.

  • Use http://localhost/nginx_status to monitor server health, with tools like munin.

[2] [3]


These same settings and instructions would also work for mediawiki based wiki site. It can be extended to support more platforms (like wordpress).


# clone git clone git://

# point nginx conf file to nginx.conf vi /etc/init.d/nginx # your distro might have different location

# restart nginx (distro dependant) /etc/init.d/nginx restart

# make sure you have a php-cgi server running on port 3000 php-cgi -b

# create a config file for your site cp conf/vhosts.d/{example,yoursite}.conf vi conf/vhosts.d/yoursite.conf

# edit conf/production, conf/staging and conf/dev to point to the directory of each env. vi conf/{production,staging,dev}

  • Running update.php and other protected PHP files

    The supplied htaccess uses the user 'user' and the password 'secret'. Be sure to change that using the 'htpasswd' command:

    htpasswd -c -b conf/htpasswd user secret

  • Adding another site

    Copy conf/example.conf and edit it

    cp conf/vhosts.d/{example,anothersite}.conf vi conf/vhosts.d/anothersite.conf

    reload nginx

    /etc/init.d/nginx reload


If you get an error about gzipstatic line, either comment it out (and lose the automatic .gz files match) or recompile nginx with the '--with-httpgzipstaticmodule' configuration option.

If you get an error about stubstatus module missing, comment those lines out, or recompile nginx with '--with-httpstubstatusmodule' configuration option.


Fork this project on GitHub and send pull requests.

Bugs, Features, Issues:

File a report on the issue tracker:


Send me an e-mail (see LICENSE for my address).

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.