Package: birdhousebuilder.recipe.nginx
Introductionbirdhousebuilder.recipe.nginxis aBuildoutrecipe to installNginxfrom anAnacondachannel and to deploy a site configuration for your application.
This recipe is used by theBirdhouseproject.UsageThe recipe requires that Anaconda is already installed. You can use the buildout optionanaconda-hometo set the prefix for the anaconda installation. Otherwise the environment variableCONDA_PREFIX(variable is set when activating a conda environment) is used as conda prefix.The recipe will install thenginxpackage from a conda channel in a conda enviroment defined byCONDA_PREFIX. The intallation folder is given by theprefixbuildout 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/nginxstart.The recipe depends onbirdhousebuilder.recipe.condaandzc.recipe.deployment.Supported optionsThis recipe supports the following options:anaconda-homeBuildout option pointing to the root folder of the Anaconda installation. Default:$HOME/anaconda.Buildout part options for the program section:prefixDeployment option to set the prefix of the installation folder. Default:/userDeployment option to set the run user.etc-userDeployment option to set the user of the/etcdirectory. Default:rootnameThe name of your application.inputThe path to aMakotemplate with a Nginx configuration for your application.worker-processesThe number of worker processes started (useautofor dynamic value). Default: 1keepalive-timeoutTimeout during keep-alive client connection will stay open on the server side. Default: 5sorganizationThe organization name for the certificate. Default:Birdhouseorganization-unitThe organization unit for the certificate. Default:Demossl-verify-clientNginx option to verify SSL client certificates. Possible values:off(default),on,optional.https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_verify_clientssl-client-certificateNginx option with the name of the bundle of CA certificates for the client. Default:esgf-ca-bundle.crt.https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_client_certificatessl-client-certificate-urlOptional URL to download a bundle of CA certificates forssl-client-certificate. Default:https://github.com/ESGF/esgf-dist/raw/master/installer/certs/esgf-ca-bundle.crtAll additional options can be used as parameters in your Nginx site configuration.Example usageThe following examplebuildout.cfginstalls Nginx with a site configuration formyapp:[buildout]
parts = myapp_nginx

anaconda-home = /opt/anaconda

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

hostname =  localhost
port = 8081An 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;
  }
}