My nginx repo (Engine X Github Repository)

I have a basic nginx (pronounced Engine EX) configuration on github. This is a basic version of perusio's nginx configuration in more of a stand-alone set up - and it uses unix sockets in the PHP connection configuration to do the processing instead of an upstream configuration (where the processing could optionally be coming from another server that has PHP), that can include Apache web servers. perusio's config is an advanced configuration with multiple failover backup servers that just wasn't necessary in my case so I decided to make another example config on github. Instead of having PHP connect to itself using TCP/IP, this setup eliminates the need for communication with itself using the TCP network layer. Data does not have to be "converted" into a standardized network layer format as it's processed from the file system through PHP. A performance enhancement side effect for stand alone nginx web servers.

For stand-alone-ish servers, doing this processing via a regular Unix socket is basically more the norm. Certainly a chance to get more out of your stand-alone nginx server versus using TCP. As mentioned, Perusio's set up includes upstreams for other webservers balancing the giant enterprise load it's configured for. My set up is one small server and a really, really fast website. I am now very pro-nginx since setting up and seeing the difference in just my browser load times.

There is support for Drupal 6 and 7, just use the appropriate include file in your virtual host configuration file. See the example.conf. I like to keep virtual host configs in separate files in the conf.d folder. With all the defaults set throughout the operational files in the root of the config, the individual config files per virtual host are small, easy to read, and easily identifiable (any .conf file in the conf.d/ folder will be parsed on nginx start up; so call it good practice to name your config files after the sites they represent - like mysite.conf or mysite.ca.conf). The files in the configuration directory "conf.d" can also be linux soft links - so if you need to allow users to make edits to their own config files they can - without letting them into the main nginx directory.

Mixing this config with perusio's micro-caching stanzas has been left as an exercise to the reader!

Also, worth a look is yhader's boost-compatible nginx configuration. While dated, it was built for Drupal and supports the Boost module, and it also proves the simplicity of a standard nginx set up. Nginx.org has a very good wiki and clear documentation. If you're doing anything with nginx, start there. This configuration is a work in progress. Check back for updates or follow me on Twitter! @slozzy

Category