Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

nginx_conf (8) Versions 0.0.2

Installs/Configures nginx_conf

Policyfile
Berkshelf
Knife
cookbook 'nginx_conf', '= 0.0.2', :supermarket
cookbook 'nginx_conf', '= 0.0.2'
knife supermarket install nginx_conf
knife supermarket download nginx_conf
README
Dependencies
Quality -%

Description

Manage nginx server configuration files.

Requirements

  • Nginx recipe.
  • Ubuntu/Debian

Attributes

See a list of all attributes.

Usage

Add the nginx_conf recipe to your runlist.

confs

Rather then accessing the LWRP directly, add a site hash to the confs attribute list.

node['nginx_conf']['confs'] = [{
'test1.mywebsite.com' => {
'root' => "/var/www/myapp",
'socket' => "/var/www/myapp/shared/tmp/sockets/unicorn.socket"
},
'test2.mywebsite.com' => {
'root' => "/var/www/myapp"
},
'test3.mywebsite.com' => {
'action' => :disable
},
'test4.mywebsite.com' => {
'action' => :delete
},
}]

Create

Creates a nginx configuration in the sites-available directory, tests it, symlinks to sites-enabled, and restarts nginx. The only required attribute is root. See a list of all LWRP attributes.

$ nginx_conf_file "mywebsite.com" do
$ root "/var/www/myapp"
$ socket "/var/www/myapp/shared/tmp/sockets/unicorn.socket"
$ end

Outputs to sites-available/mywebsite.com:

server {
listen 80;

server_name mywebsite.com;

client_max_body_size 20M;
keepalive_timeout 5;
try_files $uri/index.html $uri.html $uri @proxy;

location @proxy {
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_redirect off;
  proxy_pass http://unix:/var/www/myapp/shared/tmp/sockets/unicorn.socket;
}

}

Creating a static conf is even easier.

$ nginx_conf_file "mywebsite.com" do
$ root "/var/www/myapp"
$ end

Outputs to sites-available/mywebsite.com:

server {
listen 80;

server_name mywebsite.com;

client_max_body_size 20M;
keepalive_timeout 5;

try_files $uri/index.html $uri.html $uri;

}

Disable

Removes the symlink between sites-enabled and sites-available for the named configuration.

$ nginx_conf_file "mywebsite.com" do
$ action :disable
$ end

Delete

Removes the symlink and deletes the configuration:

$ nginx_conf_file "mywebsite.com" do
$ action :delete
$ end

Testing

We use kitchen-test to check basic functionality. To run tests:

$ bundle install
$ kitchen test

NOTE: This will download a vagrant basebox for Ubuntu 10.04 and setup vagrant at test/kitchen/.kitchen

No quality metric results found