# Nginx cookbook usage help

**URL:** <https://discourse.chef.io/t/nginx-cookbook-usage-help/3092>\
**Category:** Chef Infra (archive)\
**Created:** [August 2, 2012, 11:28am UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092 "2012-08-02T11:28:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [August 2, 2012, 11:28am UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/1 "2012-08-02T11:28:54Z")

</div>

I’ve got the nginx cookbook in place now, but I’m a little fuzzy on how to  
proceed next. I bootstrapped a node and it configured nginx with all the  
defaults. I wrote my own config block which I would like to either:

- place in /etc/nginx/sites-available
- create a symlink to it in /etc/nginx/sites-enabled
- disable the /etc/nginx/sites-enabled/default symlink

Or, to just replace the default config block directly and save the hassle  
of mucking around with multiple files.

What’s the best way to go about this?

Also, I’m using a SVN repo for my chef repo, because we do our hosting on  
Jira OnDemand, which doesn’t offer Git (yet). Is there any way I can get  
"knife cookbook download" to play nice with SVN? Can I use git-svn to use  
it as a git repo locally but push commits to the master over SVN? I’m sure  
I’m not the first person to run into this issue…

Thanks for any help.

–  
~_~ StormeRider ~_~

“Every world needs its heroes […] They inspire us to be better than we  
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

---

<div class="post-metadata">

**Author:** ![Dan\_Crosta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/dan_crosta/32/678_2.png) [@Dan\_Crosta](https://discourse.chef.io/u/Dan_Crosta)\
**Post date:** [August 2, 2012, 12:19pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/2 "2012-08-02T12:19:44Z")

</div>

On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:

> I've got the nginx cookbook in place now, but I'm a little fuzzy on how to proceed next. I bootstrapped a node and it configured nginx with all the defaults. I wrote my own config block which I would like to either:  
> place in /etc/nginx/sites-available  
> create a symlink to it in /etc/nginx/sites-enabled  
> disable the /etc/nginx/sites-enabled/default symlink  
> You can drop a file in /etc/nginx/sites-available, and then use

```
nginx_site "name-of-your-file-in-sites-available" do
  enable true
end

```

to have Chef enable the site for you (reloading nginx's configuration as appropriate)

> Or, to just replace the default config block directly and save the hassle of mucking around with multiple files.
> 
> What's the best way to go about this?

Recent versions of the nginx cookbook have an attribute node["nginx"]["default\_site\_enabled"] which you can set to false to disable the default site. You can then use the above recommendation to institute your own default site. You can set this from a recipe, role, environment, etc.

- Dan

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [August 2, 2012, 12:29pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/3 "2012-08-02T12:29:25Z")

</div>

Thanks, but I'm a bit more used to Puppet. Where can I put the actual file  
in Chef to push it to the node? I'd like to autoconfigure the node  
completely with Chef. Does that go in a databag, or a template, or?

Still trying to get bootstrapped myself 🙂 Too bad there's know  
"knife-person bootstrap"...

--  
~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:

> On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> 
> I've got the nginx cookbook in place now, but I'm a little fuzzy on how to  
> proceed next. I bootstrapped a node and it configured nginx with all the  
> defaults. I wrote my own config block which I would like to either:
> 
> - place in /etc/nginx/sites-available
> - create a symlink to it in /etc/nginx/sites-enabled
> - disable the /etc/nginx/sites-enabled/default symlink
> 
> You can drop a file in /etc/nginx/sites-available, and then use
> 
> ```
> nginx_site "name-of-your-file-in-sites-available" do
> enable true
> end
> 
> ```
> 
> to have Chef enable the site for you (reloading nginx's configuration as  
> appropriate)
> 
> Or, to just replace the default config block directly and save the hassle  
> of mucking around with multiple files.
> 
> What's the best way to go about this?
> 
> Recent versions of the nginx cookbook have an attribute  
> node["nginx"]["default\_site\_enabled"] which you can set to false to disable  
> the default site. You can then use the above recommendation to institute  
> your own default site. You can set this from a recipe, role, environment,  
> etc.
> 
> - Dan

---

<div class="post-metadata">

**Author:** ![Dan\_Crosta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/dan_crosta/32/678_2.png) [@Dan\_Crosta](https://discourse.chef.io/u/Dan_Crosta)\
**Post date:** [August 2, 2012, 12:33pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/4 "2012-08-02T12:33:39Z")

</div>

On Aug 2, 2012, at 8:29 AM, Morgan Blackthorne [stormerider@gmail.com](mailto:stormerider@gmail.com) wrote:

> Thanks, but I'm a bit more used to Puppet. Where can I put the actual file in Chef to push it to the node? I'd like to autoconfigure the node completely with Chef. Does that go in a databag, or a template, or?

Check out the cookbook\_file resource: [http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile](http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile). I think that does what you want. You could also use template, which gives you the ability to vary some of the file contents based on node attributes or variables in your recipe, etc.

> Still trying to get bootstrapped myself 🙂 Too bad there's know "knife-person bootstrap"...
> 
> --  
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:  
> On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> 
> > I've got the nginx cookbook in place now, but I'm a little fuzzy on how to proceed next. I bootstrapped a node and it configured nginx with all the defaults. I wrote my own config block which I would like to either:  
> > place in /etc/nginx/sites-available  
> > create a symlink to it in /etc/nginx/sites-enabled  
> > disable the /etc/nginx/sites-enabled/default symlink
> 
> You can drop a file in /etc/nginx/sites-available, and then use
> 
> ```
> nginx_site "name-of-your-file-in-sites-available" do
> enable true
> end
> 
> ```
> 
> to have Chef enable the site for you (reloading nginx's configuration as appropriate)
> 
> > Or, to just replace the default config block directly and save the hassle of mucking around with multiple files.
> > 
> > What's the best way to go about this?
> 
> Recent versions of the nginx cookbook have an attribute node["nginx"]["default\_site\_enabled"] which you can set to false to disable the default site. You can then use the above recommendation to institute your own default site. You can set this from a recipe, role, environment, etc.
> 
> - Dan

---

<div class="post-metadata">

**Author:** ![Sascha\_Bates](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/sascha_bates/32/504_2.png) [@Sascha\_Bates](https://discourse.chef.io/u/Sascha_Bates)\
**Post date:** [August 2, 2012, 1:42pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/5 "2012-08-02T13:42:04Z")

</div>

```
When I did some work on Puppet, I found the concept of the file
server hella confusing as I had come from Chef. I also found the
documentation on where to put template files and file-files
confusing. (You should put templates in X dir but Puppet will look
for them in Y dir first, WAT?)

In Chef, when you have a file or template associated with a
cookbook, you can simply drop them in
&lt;cookbook&gt;/templates/default and
&lt;cookbook&gt;/files/default. There are more complex use cases as
well, however, 99% of the time the default directory is good enough
for what you want.

When referencing the files in recipes, you use the "source"
attribute and chef will figure out where the file is starting by
looking in those default cookbook directories.

cookbook_file "/etc/blah/blah.config" do

  source "blah.config"

end

This is all in the resource reference page, but I figured it was
worth talking about in more detail if you are used to Puppet and a
file server. Chef and Puppet seem to come at this from odd
directions if you are used to one over the other. I actually
started a Puppet for Chef users series on my blog and was going to
talk about files and templates, but figuring it out for Puppet kind
of gave me some ragefaces. And by the time I was over it, I was
working on something else. I may revisit.

```

```
Sascha
```

```
On 8/2/12 7:29 AM, Morgan Blackthorne wrote:
<blockquote cite="mid:CAE=pETvmoDRpOBdQ5fMFXTWFULxfs4cCNQ8R=rcqVBR5PZx6mw@mail.gmail.com" type="cite">Thanks, but I'm a bit more used to Puppet. Where can I
  put the actual file in Chef to push it to the node? I'd like to
  autoconfigure the node completely with Chef. Does that go in a
  databag, or a template, or?

```

Still trying to get bootstrapped myself 🙂 Too bad there's  
know "knife-person bootstrap"...

```
      --
      ~*~ StormeRider ~*~

```

"Every world needs its heroes [...] They inspire us to  
be better than we are. And they protect from the darkness  
that's just around the corner."

(from Smallville Season 6x1: "Zod")

On Thu, Aug 2, 2012 at 5:19 AM, Dan  
Crosta \<[dcrosta@late.am](mailto:dcrosta@late.am)\>  
wrote:

> On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> 
> > I've got the nginx cookbook in place now, but I'm a little fuzzy on how to proceed next. I bootstrapped a node and it configured nginx with all the defaults. I wrote my own config block which I would like to either: 
> > - place in /etc/nginx/sites-available
> > - create a symlink to it in /etc/nginx/sites-enabled
> > - disable the /etc/nginx/sites-enabled/default symlink
> 
> You can drop a file in /etc/nginx/sites-available, and then use
> 
> ```
> nginx_site
> "name-of-your-file-in-sites-available" do enable true end
> 
> ```
> 
> to have Chef enable the site for you (reloading  
> nginx's configuration as appropriate)
> 
> > Or, to just replace the default config block directly and save the hassle of mucking around with multiple files.
> > 
> > What's the best way to go about this?
> 
> Recent versions of the nginx cookbook have an  
> attribute node["nginx"]["default\_site\_enabled"]  
> which you can set to false to disable the default  
> site. You can then use the above recommendation to  
> institute your own default site. You can set this  
> from a recipe, role, environment, etc.
> 
> - Dan

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [August 2, 2012, 1:59pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/6 "2012-08-02T13:59:31Z")

</div>

Do you have a link to your old blog series, so I can catch up on what  
differences you did note?

--  
~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On Thu, Aug 2, 2012 at 6:42 AM, Sascha Bates [sascha.bates@gmail.com](mailto:sascha.bates@gmail.com) wrote:

> When I did some work on Puppet, I found the concept of the file server  
> hella confusing as I had come from Chef. I also found the documentation on  
> where to put template files and file-files confusing. (You should put  
> templates in X dir but Puppet will look for them in Y dir first, WAT?)
> 
> In Chef, when you have a file or template associated with a cookbook, you  
> can simply drop them in /templates/default and  
> /files/default. There are more complex use cases as well,  
> however, 99% of the time the default directory is good enough for what you  
> want.
> 
> When referencing the files in recipes, you use the "source" attribute and  
> chef will figure out where the file is starting by looking in those default  
> cookbook directories.
> 
> cookbook\_file "/etc/blah/blah.config" do  
> source "blah.config"  
> end
> 
> This is all in the resource reference page, but I figured it was worth  
> talking about in more detail if you are used to Puppet and a file server.  
> Chef and Puppet seem to come at this from odd directions if you are used to  
> one over the other. I actually started a Puppet for Chef users series on  
> my blog and was going to talk about files and templates, but figuring it  
> out for Puppet kind of gave me some ragefaces. And by the time I was over  
> it, I was working on something else. I may revisit.
> 
> Sascha
> 
> On 8/2/12 7:29 AM, Morgan Blackthorne wrote:
> 
> Thanks, but I'm a bit more used to Puppet. Where can I put the actual file  
> in Chef to push it to the node? I'd like to autoconfigure the node  
> completely with Chef. Does that go in a databag, or a template, or?
> 
> Still trying to get bootstrapped myself 🙂 Too bad there's know  
> "knife-person bootstrap"...
> 
> --  
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than we  
> are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:
> 
> > On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> > 
> > I've got the nginx cookbook in place now, but I'm a little fuzzy on how  
> > to proceed next. I bootstrapped a node and it configured nginx with all the  
> > defaults. I wrote my own config block which I would like to either:
> > 
> > - place in /etc/nginx/sites-available
> > - create a symlink to it in /etc/nginx/sites-enabled
> > - disable the /etc/nginx/sites-enabled/default symlink
> > 
> > You can drop a file in /etc/nginx/sites-available, and then use
> > 
> > ```
> > nginx_site "name-of-your-file-in-sites-available" do
> > enable true
> > end
> > 
> > ```
> > 
> > to have Chef enable the site for you (reloading nginx's configuration  
> > as appropriate)
> > 
> > Or, to just replace the default config block directly and save the  
> > hassle of mucking around with multiple files.
> > 
> > What's the best way to go about this?
> > 
> > Recent versions of the nginx cookbook have an attribute  
> > node["nginx"]["default\_site\_enabled"] which you can set to false to disable  
> > the default site. You can then use the above recommendation to institute  
> > your own default site. You can set this from a recipe, role, environment,  
> > etc.
> > 
> > - Dan

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [August 2, 2012, 2:54pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/7 "2012-08-02T14:54:01Z")

</div>

So with some help from tigris on #Chef Infra (archive), I got the config mostly sorted out.

However, when I do a chef-client run on the node, I now get:

root@domU-12-31-39-0B-4E-C3:/etc# chef-client  
[Thu, 02 Aug 2012 14:47:22 +0000] INFO: \*\*\* Chef 10.12.0 \*\*\*  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List is  
[role[nginx-server-cloudant]]  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List expands to [users, sudo,  
nginx]  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Starting Chef Run for  
domU-12-31-39-0B-4E-C3.compute-1.internal  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Running start handlers  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Start handlers complete.  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Loading cookbooks [bluepill,  
build-essential, nginx, ohai, runit, sudo, users, yum]  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: Storing updated  
cookbooks/nginx/recipes/proxy-cloudant.rb in the cache.  
[Thu, 02 Aug 2012 14:47:24 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:47:24 +0000] ERROR: Server returned error for  
[http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
retrying 1/5 in 3s  
[Thu, 02 Aug 2012 14:47:27 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:47:27 +0000] ERROR: Server returned error for  
[http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
retrying 2/5 in 5s  
[Thu, 02 Aug 2012 14:47:32 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:47:32 +0000] ERROR: Server returned error for  
[http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
retrying 3/5 in 12s  
[Thu, 02 Aug 2012 14:47:44 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:47:44 +0000] ERROR: Server returned error for  
[http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
retrying 4/5 in 23s  
[Thu, 02 Aug 2012 14:48:07 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:48:07 +0000] ERROR: Server returned error for  
[http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
retrying 5/5 in 51s  
[Thu, 02 Aug 2012 14:48:58 +0000] INFO: HTTP Request Returned 500 Internal  
Server Error: Net::HTTPServerException: 404 "Not Found"  
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Running exception handlers  
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Saving node information to  
/var/cache/chef/failed-run-data.json  
[Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Exception handlers complete  
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Stacktrace dumped to  
/var/cache/chef/chef-stacktrace.out  
[Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Net::HTTPFatalError: 500 "Internal  
Server Error"  
root@domU-12-31-39-0B-4E-C3:/etc#

Any idea what might be going on? I'm not sure what it's trying to retrieve  
so I'm not sure which log to look into. I was having some stability  
problems so I moved from the deb setup to gem setup recently, but I can  
look at the web UI and use knife node list, knife role list, etc. just fine.

Thanks!

--  
~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On Thu, Aug 2, 2012 at 5:33 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:

> On Aug 2, 2012, at 8:29 AM, Morgan Blackthorne [stormerider@gmail.com](mailto:stormerider@gmail.com)  
> wrote:
> 
> Thanks, but I'm a bit more used to Puppet. Where can I put the actual file  
> in Chef to push it to the node? I'd like to autoconfigure the node  
> completely with Chef. Does that go in a databag, or a template, or?
> 
> Check out the cookbook\_file resource:  
> [http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile](http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile). I  
> think that does what you want. You could also use template, which gives you  
> the ability to vary some of the file contents based on node attributes or  
> variables in your recipe, etc.
> 
> Still trying to get bootstrapped myself 🙂 Too bad there's know  
> "knife-person bootstrap"...
> 
> --  
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than we  
> are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:
> 
> > On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> > 
> > I've got the nginx cookbook in place now, but I'm a little fuzzy on how  
> > to proceed next. I bootstrapped a node and it configured nginx with all the  
> > defaults. I wrote my own config block which I would like to either:
> > 
> > - place in /etc/nginx/sites-available
> > - create a symlink to it in /etc/nginx/sites-enabled
> > - disable the /etc/nginx/sites-enabled/default symlink
> > 
> > You can drop a file in /etc/nginx/sites-available, and then use
> > 
> > ```
> > nginx_site "name-of-your-file-in-sites-available" do
> > enable true
> > end
> > 
> > ```
> > 
> > to have Chef enable the site for you (reloading nginx's configuration as  
> > appropriate)
> > 
> > Or, to just replace the default config block directly and save the hassle  
> > of mucking around with multiple files.
> > 
> > What's the best way to go about this?
> > 
> > Recent versions of the nginx cookbook have an attribute  
> > node["nginx"]["default\_site\_enabled"] which you can set to false to disable  
> > the default site. You can then use the above recommendation to institute  
> > your own default site. You can set this from a recipe, role, environment,  
> > etc.
> > 
> > - Dan

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [August 2, 2012, 3:15pm UTC](https://discourse.chef.io/t/nginx-cookbook-usage-help/3092/8 "2012-08-02T15:15:23Z")

</div>

Sorted it out... was a problem with solr not working right.

Sorry for the noise 🙂

--  
~_~ StormeRider ~_~

"Every world needs its heroes [...] They inspire us to be better than we  
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On Thu, Aug 2, 2012 at 7:54 AM, Morgan Blackthorne [stormerider@gmail.com](mailto:stormerider@gmail.com)wrote:

> So with some help from tigris on #Chef Infra (archive), I got the config mostly sorted out.
> 
> However, when I do a chef-client run on the node, I now get:
> 
> root@domU-12-31-39-0B-4E-C3:/etc# chef-client  
> [Thu, 02 Aug 2012 14:47:22 +0000] INFO: \*\*\* Chef 10.12.0 \*\*\*  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List is  
> [role[nginx-server-cloudant]]  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Run List expands to [users, sudo,  
> nginx]  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Starting Chef Run for  
> domU-12-31-39-0B-4E-C3.compute-1.internal  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Running start handlers  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Start handlers complete.  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Loading cookbooks [bluepill,  
> build-essential, nginx, ohai, runit, sudo, users, yum]  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: Storing updated  
> cookbooks/nginx/recipes/proxy-cloudant.rb in the cache.  
> [Thu, 02 Aug 2012 14:47:24 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:47:24 +0000] ERROR: Server returned error for  
> [http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
> retrying 1/5 in 3s  
> [Thu, 02 Aug 2012 14:47:27 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:47:27 +0000] ERROR: Server returned error for  
> [http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
> retrying 2/5 in 5s  
> [Thu, 02 Aug 2012 14:47:32 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:47:32 +0000] ERROR: Server returned error for  
> [http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
> retrying 3/5 in 12s  
> [Thu, 02 Aug 2012 14:47:44 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:47:44 +0000] ERROR: Server returned error for  
> [http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
> retrying 4/5 in 23s  
> [Thu, 02 Aug 2012 14:48:07 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:48:07 +0000] ERROR: Server returned error for  
> [http://redacted:4000/search/users?q=\*:\*&sort=X\_CHEF\_id\_CHEF\_X%20asc&start=0&rows=1000](http://redacted:4000/search/users?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000),  
> retrying 5/5 in 51s  
> [Thu, 02 Aug 2012 14:48:58 +0000] INFO: HTTP Request Returned 500 Internal  
> Server Error: Net::HTTPServerException: 404 "Not Found"  
> [Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Running exception handlers  
> [Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Saving node information to  
> /var/cache/chef/failed-run-data.json  
> [Thu, 02 Aug 2012 14:48:58 +0000] ERROR: Exception handlers complete  
> [Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Stacktrace dumped to  
> /var/cache/chef/chef-stacktrace.out  
> [Thu, 02 Aug 2012 14:48:58 +0000] FATAL: Net::HTTPFatalError: 500  
> "Internal Server Error"  
> root@domU-12-31-39-0B-4E-C3:/etc#
> 
> Any idea what might be going on? I'm not sure what it's trying to retrieve  
> so I'm not sure which log to look into. I was having some stability  
> problems so I moved from the deb setup to gem setup recently, but I can  
> look at the web UI and use knife node list, knife role list, etc. just fine.
> 
> Thanks!
> 
> --  
> ~_~ StormeRider ~_~
> 
> "Every world needs its heroes [...] They inspire us to be better than we  
> are. And they protect from the darkness that's just around the corner."
> 
> (from Smallville Season 6x1: "Zod")
> 
> On Thu, Aug 2, 2012 at 5:33 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:
> 
> > On Aug 2, 2012, at 8:29 AM, Morgan Blackthorne [stormerider@gmail.com](mailto:stormerider@gmail.com)  
> > wrote:
> > 
> > Thanks, but I'm a bit more used to Puppet. Where can I put the actual  
> > file in Chef to push it to the node? I'd like to autoconfigure the node  
> > completely with Chef. Does that go in a databag, or a template, or?
> > 
> > Check out the cookbook\_file resource:  
> > [http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile](http://wiki.opscode.com/display/chef/Resources#Resources-CookbookFile). I  
> > think that does what you want. You could also use template, which gives you  
> > the ability to vary some of the file contents based on node attributes or  
> > variables in your recipe, etc.
> > 
> > Still trying to get bootstrapped myself 🙂 Too bad there's know  
> > "knife-person bootstrap"...
> > 
> > --  
> > ~_~ StormeRider ~_~
> > 
> > "Every world needs its heroes [...] They inspire us to be better than we  
> > are. And they protect from the darkness that's just around the corner."
> > 
> > (from Smallville Season 6x1: "Zod")
> > 
> > On Thu, Aug 2, 2012 at 5:19 AM, Dan Crosta [dcrosta@late.am](mailto:dcrosta@late.am) wrote:
> > 
> > > On Aug 2, 2012, at 7:28 AM, Morgan Blackthorne wrote:
> > > 
> > > I've got the nginx cookbook in place now, but I'm a little fuzzy on how  
> > > to proceed next. I bootstrapped a node and it configured nginx with all the  
> > > defaults. I wrote my own config block which I would like to either:
> > > 
> > > - place in /etc/nginx/sites-available
> > > - create a symlink to it in /etc/nginx/sites-enabled
> > > - disable the /etc/nginx/sites-enabled/default symlink
> > > 
> > > You can drop a file in /etc/nginx/sites-available, and then use
> > > 
> > > ```
> > > nginx_site "name-of-your-file-in-sites-available" do
> > > enable true
> > > end
> > > 
> > > ```
> > > 
> > > to have Chef enable the site for you (reloading nginx's configuration as  
> > > appropriate)
> > > 
> > > Or, to just replace the default config block directly and save the  
> > > hassle of mucking around with multiple files.
> > > 
> > > What's the best way to go about this?
> > > 
> > > Recent versions of the nginx cookbook have an attribute  
> > > node["nginx"]["default\_site\_enabled"] which you can set to false to disable  
> > > the default site. You can then use the above recommendation to institute  
> > > your own default site. You can set this from a recipe, role, environment,  
> > > etc.
> > > 
> > > - Dan
