Skip to main content

A Buildout recipe to install and configure Nginx with conda.

Project description

Travis Build


birdhousebuilder.recipe.nginx is a Buildout recipe to install Nginx from an Anaconda channel and to deploy a site configuration for your application. This recipe is used by the Birdhouse project.


The recipe requires that Anaconda is already installed. You can use the buildout option anaconda-home to set the prefix for the anaconda installation. Otherwise the environment variable CONDA_PREFIX (variable is set when activating a conda environment) is used as conda prefix.

The recipe will install the nginx package from a conda channel in a conda enviroment defined by CONDA_PREFIX. The intallation folder is given by the prefix buildout option. It deploys a Nginx site configuration for your application. The configuration will be deployed in ${prefix}/etc/nginx/conf.d/myapp.conf. Nginx can be started with ${prefix}/etc/init.d/nginx start.

The recipe depends on birdhousebuilder.recipe.conda and zc.recipe.deployment.

Supported options

This recipe supports the following options:


Buildout option pointing to the root folder of the Anaconda installation. Default: $HOME/anaconda.

Buildout part options for the program section:


Deployment option to set the prefix of the installation folder. Default: /


Deployment option to set the run user.


Deployment option to set the user of the /etc directory. Default: root


The name of your application.


The path to a Mako template with a Nginx configuration for your application.


The number of worker processes started (use auto for dynamic value). Default: 1


Timeout during keep-alive client connection will stay open on the server side. Default: 5s


The organization name for the certificate. Default: Birdhouse


The organization unit for the certificate. Default: Demo


Nginx option to verify SSL client certificates. Possible values: off (default), on, optional.


Nginx option with the name of the bundle of CA certificates for the client. Default: esgf-ca-bundle.crt.


Optional URL to download a bundle of CA certificates for ssl-client-certificate. Default:

All additional options can be used as parameters in your Nginx site configuration.

Example usage

The following example buildout.cfg installs Nginx with a site configuration for myapp:

parts = myapp_nginx

anaconda-home = /opt/anaconda

recipe = birdhousebuilder.recipe.nginx
name = myapp
prefix = /
user = www-data
input = ${buildout:directory}/templates/myapp_nginx.conf

hostname =  localhost
port = 8081

An example Mako template for your Nginx configuration could look like this:

upstream myapp {
  server unix:///tmp/myapp.socket fail_timeout=0;

server {
  listen ${port};
  server_name ${hostname};

  root ${prefix}/var/www;
  index index.html index.htm;

  location / {
    # checks for static file, if not found proxy to app
    try_files $uri @proxy_to_phoenix;

  location @proxy_to_phoenix {
      proxy_pass http://myapp;

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

birdhousebuilder.recipe.nginx-0.4.2.tar.gz (11.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page