# NGINX -- default\_site\_enabled issue

**URL:** <https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074>\
**Category:** Chef Infra (archive)\
**Created:** [June 11, 2013, 9:52pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074 "2013-06-11T21:52:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 11, 2013, 9:52pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/1 "2013-06-11T21:52:50Z")

</div>

Hi --

I'm using the application\_nginx cookbook which includes the nginx cookbook.  
In my wrapper cookbook I have

cookbooks/bti\_api/attributes/default.rb:  
override[:nginx][:default\_site\_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the  
nginx.conf file is

> include /etc/nginx/conf.d/_.conf;  
> include /etc/nginx/sites-enabled/_;  
> }  
> And conf.d/default.conf exists.

So, it seems that default\_site\_enabled is being ignored. Is this not  
the way to turn off the default\_site?

Possibly relevant info:  
I'm using the nginx::repo recipe

The run\_list:

> INFO: Loading cookbooks [application, application\_nginx,  
> application\_python, apt, aws, bti\_api, build-essential, chef\_handler,  
> erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,  
> supervisor, windows, yum]

The

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![Nic\_Grayson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/nic_grayson/32/331_2.png) [@Nic\_Grayson](https://discourse.chef.io/u/Nic_Grayson)\
**Post date:** [June 12, 2013, 3:04pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/2 "2013-06-12T15:04:53Z")

</div>

The upstream nginx cookbook enables the default site. I just call the  
nginx\_site definition on default to disable it.

nginx\_site "default" do  
enable false  
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:

> Hi --
> 
> I'm using the application\_nginx cookbook which includes the nginx cookbook.  
> In my wrapper cookbook I have
> 
> cookbooks/bti\_api/attributes/default.rb:  
> override[:nginx][:default\_site\_enabled] = false
> 
> However, the NGINX default site is still enabled! At the bottom of the  
> nginx.conf file is
> 
> > include /etc/nginx/conf.d/_.conf;  
> > include /etc/nginx/sites-enabled/_;  
> > }  
> > And conf.d/default.conf exists.
> 
> So, it seems that default\_site\_enabled is being ignored. Is this not  
> the way to turn off the default\_site?
> 
> Possibly relevant info:  
> I'm using the nginx::repo recipe
> 
> The run\_list:
> 
> > INFO: Loading cookbooks [application, application\_nginx,  
> > application\_python, apt, aws, bti\_api, build-essential, chef\_handler,  
> > erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,  
> > supervisor, windows, yum]
> 
> The
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 12, 2013, 5:38pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/3 "2013-06-12T17:38:54Z")

</div>

Nic,

Thanks for your response.

I tried that but it didn't work. When I included it in my recipe the  
converge threw an exception

> include\_recipe "nginx::repo"  
> nginx\_site "default" do  
> enable false  
> end

> [2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:  
> resource execute[nxdissite default] is configured to notify resource  
> service[nginx] with action reload, but service[nginx] cannot be found  
> in the resource collection. execute[nxdissite default] is defined in  
> /srv/chef/file\_store/cookbooks/nginx/definitions/nginx\_site.rb:32:in  
> `block in from\_file'  
> Am I not referencing it correctly?

I looked in the nginx\_site definition, and that only seems to deal with  
the ubuntu style of linking sites in the sites-enabled directory -- so  
this may be a moot point anyway.  
In this case (I think because it comes from the repo) nginx.conf _also_  
is including conf.d/\*.conf. That directory includes a default.conf  
which is also listening on the same interface and port, so that creates  
a conflict.

The default template nginx.conf.erb ends with:  
include \<%= node['nginx']['dir'] %\>/conf.d/_.conf;  
include \<%= node['nginx']['dir'] %\>/sites-enabled/_;

It seems like the two host configuration schemes are colliding. (Or,  
perhaps, conf.d /could/ be used for other type of configuration  
includes. But in this case, it has a default site defined.)

I kinda think this is a bug in the template, but it may be correct for  
other versions of nginx (it's getting 1.4.1 from the repo).

In any case, thanks for the suggestion.

Liam

On 06/12/2013 08:04 AM, Nic Grayson wrote:

> The upstream nginx cookbook enables the default site. I just call the  
> nginx\_site definition on default to disable it.
> 
> nginx\_site "default" do  
> enable false  
> end
> 
> Nic
> 
> On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher \<[liamk@numenet.com](mailto:liamk@numenet.com)  
> [mailto:liamk@numenet.com](mailto:liamk@numenet.com)\> wrote:
> 
> ```
> Hi --
> 
> I'm using the application_nginx cookbook which includes the nginx
> cookbook.
> In my wrapper cookbook I have
> 
> cookbooks/bti_api/attributes/default.rb:
> override[:nginx][:default_site_enabled] = false
> 
> However, the NGINX default site is still enabled! At the bottom
> of the
> nginx.conf file is
> > include /etc/nginx/conf.d/*.conf;
> > include /etc/nginx/sites-enabled/*;
> > }
> And conf.d/default.conf exists.
> 
> So, it seems that default_site_enabled is being ignored. Is this not
> the way to turn off the default_site?
> 
> Possibly relevant info:
> I'm using the nginx::repo recipe
> 
> The run_list:
> > INFO: Loading cookbooks [application, application_nginx,
> > application_python, apt, aws, bti_api, build-essential,
> chef_handler,
> > erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
> > supervisor, windows, yum]
> 
> The
> 
> --
> Liam Kirsher
> PGP: http://liam.numenet.com/pgp/
> 
> ```

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [June 12, 2013, 9:36pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/4 "2013-06-12T21:36:57Z")

</div>

service[nginx] is provided by a different recipe, not nginx::repo. You  
probably need nginx::server or nginx::default.

Cheers,

AJ

On 13 June 2013 05:38, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:

> Nic,
> 
> Thanks for your response.
> 
> I tried that but it didn't work. When I included it in my recipe the  
> converge threw an exception
> 
> include\_recipe "nginx::repo"
> 
> nginx\_site "default" do  
> enable false  
> end
> 
> [2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:  
> resource execute[nxdissite default] is configured to notify resource  
> service[nginx] with action reload, but service[nginx] cannot be found in the  
> resource collection. execute[nxdissite default] is defined in  
> /srv/chef/file\_store/cookbooks/nginx/definitions/nginx\_site.rb:32:in `block  
> in from\_file'
> 
> Am I not referencing it correctly?
> 
> I looked in the nginx\_site definition, and that only seems to deal with the  
> ubuntu style of linking sites in the sites-enabled directory -- so this may  
> be a moot point anyway.  
> In this case (I think because it comes from the repo) nginx.conf _also_ is  
> including conf.d/\*.conf. That directory includes a default.conf which is  
> also listening on the same interface and port, so that creates a conflict.
> 
> The default template nginx.conf.erb ends with:  
> include \<%= node['nginx']['dir'] %\>/conf.d/_.conf;  
> include \<%= node['nginx']['dir'] %\>/sites-enabled/_;
> 
> It seems like the two host configuration schemes are colliding. (Or,  
> perhaps, conf.d could be used for other type of configuration includes. But  
> in this case, it has a default site defined.)
> 
> I kinda think this is a bug in the template, but it may be correct for other  
> versions of nginx (it's getting 1.4.1 from the repo).
> 
> In any case, thanks for the suggestion.
> 
> Liam
> 
> On 06/12/2013 08:04 AM, Nic Grayson wrote:
> 
> The upstream nginx cookbook enables the default site. I just call the  
> nginx\_site definition on default to disable it.
> 
> nginx\_site "default" do  
> enable false  
> end
> 
> Nic
> 
> On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:
> 
> > Hi --
> > 
> > I'm using the application\_nginx cookbook which includes the nginx  
> > cookbook.  
> > In my wrapper cookbook I have
> > 
> > cookbooks/bti\_api/attributes/default.rb:  
> > override[:nginx][:default\_site\_enabled] = false
> > 
> > However, the NGINX default site is still enabled! At the bottom of the  
> > nginx.conf file is
> > 
> > > include /etc/nginx/conf.d/_.conf;  
> > > include /etc/nginx/sites-enabled/_;  
> > > }  
> > > And conf.d/default.conf exists.
> > 
> > So, it seems that default\_site\_enabled is being ignored. Is this not  
> > the way to turn off the default\_site?
> > 
> > Possibly relevant info:  
> > I'm using the nginx::repo recipe
> > 
> > The run\_list:
> > 
> > > INFO: Loading cookbooks [application, application\_nginx,  
> > > application\_python, apt, aws, bti\_api, build-essential, chef\_handler,  
> > > erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,  
> > > supervisor, windows, yum]
> > 
> > The
> > 
> > --  
> > Liam Kirsher  
> > PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![Liam\_Kirsher](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/liam_kirsher/32/279_2.png) [@Liam\_Kirsher](https://discourse.chef.io/u/Liam_Kirsher)\
**Post date:** [June 12, 2013, 11:52pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/5 "2013-06-12T23:52:39Z")

</div>

The docs say:

> - default.rb: /Use this recipe/ if you have a native package for Nginx.
> - repo.rb: The developer of Nginx also maintain stable packages  
> [http://nginx.org/en/download.html](http://nginx.org/en/download.html) for several platforms.
> - source.rb: /Use this recipe/ if you do not have a native package  
> for Nginx, or if you want to install a newer version than is  
> available, or if you have custom module compilation needs.

nginx::default failed on the box I was using, opscode-ubuntu-1204, so I  
used repo.

Don't know if it's related, but I'm also using application\_nginx, which  
creates an entry in sites-enabled:  
.conf

On 06/12/2013 02:36 PM, AJ Christensen wrote:

> service[nginx] is provided by a different recipe, not nginx::repo. You  
> probably need nginx::server or nginx::default.
> 
> Cheers,
> 
> AJ
> 
> On 13 June 2013 05:38, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:
> 
> > Nic,
> > 
> > Thanks for your response.
> > 
> > I tried that but it didn't work. When I included it in my recipe the  
> > converge threw an exception
> > 
> > include\_recipe "nginx::repo"
> > 
> > nginx\_site "default" do  
> > enable false  
> > end
> > 
> > [2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:  
> > resource execute[nxdissite default] is configured to notify resource  
> > service[nginx] with action reload, but service[nginx] cannot be found in the  
> > resource collection. execute[nxdissite default] is defined in  
> > /srv/chef/file\_store/cookbooks/nginx/definitions/nginx\_site.rb:32:in `block  
> > in from\_file'
> > 
> > Am I not referencing it correctly?
> > 
> > I looked in the nginx\_site definition, and that only seems to deal with the  
> > ubuntu style of linking sites in the sites-enabled directory -- so this may  
> > be a moot point anyway.  
> > In this case (I think because it comes from the repo) nginx.conf _also_ is  
> > including conf.d/\*.conf. That directory includes a default.conf which is  
> > also listening on the same interface and port, so that creates a conflict.
> > 
> > The default template nginx.conf.erb ends with:  
> > include \<%= node['nginx']['dir'] %\>/conf.d/_.conf;  
> > include \<%= node['nginx']['dir'] %\>/sites-enabled/_;
> > 
> > It seems like the two host configuration schemes are colliding. (Or,  
> > perhaps, conf.d could be used for other type of configuration includes. But  
> > in this case, it has a default site defined.)
> > 
> > I kinda think this is a bug in the template, but it may be correct for other  
> > versions of nginx (it's getting 1.4.1 from the repo).
> > 
> > In any case, thanks for the suggestion.
> > 
> > Liam
> > 
> > On 06/12/2013 08:04 AM, Nic Grayson wrote:
> > 
> > The upstream nginx cookbook enables the default site. I just call the  
> > nginx\_site definition on default to disable it.
> > 
> > nginx\_site "default" do  
> > enable false  
> > end
> > 
> > Nic
> > 
> > On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:
> > 
> > > Hi --
> > > 
> > > I'm using the application\_nginx cookbook which includes the nginx  
> > > cookbook.  
> > > In my wrapper cookbook I have
> > > 
> > > cookbooks/bti\_api/attributes/default.rb:  
> > > override[:nginx][:default\_site\_enabled] = false
> > > 
> > > However, the NGINX default site is still enabled! At the bottom of the  
> > > nginx.conf file is
> > > 
> > > > include /etc/nginx/conf.d/_.conf;  
> > > > include /etc/nginx/sites-enabled/_;  
> > > > }  
> > > > And conf.d/default.conf exists.
> > > 
> > > So, it seems that default\_site\_enabled is being ignored. Is this not  
> > > the way to turn off the default\_site?
> > > 
> > > Possibly relevant info:  
> > > I'm using the nginx::repo recipe
> > > 
> > > The run\_list:
> > > 
> > > > INFO: Loading cookbooks [application, application\_nginx,  
> > > > application\_python, apt, aws, bti\_api, build-essential, chef\_handler,  
> > > > erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,  
> > > > supervisor, windows, yum]
> > > 
> > > The
> > > 
> > > --  
> > > Liam Kirsher  
> > > PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
> > 
> > --  
> > Liam Kirsher  
> > PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

--  
Liam Kirsher  
PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [June 12, 2013, 11:57pm UTC](https://discourse.chef.io/t/nginx-default-site-enabled-issue/4074/6 "2013-06-12T23:57:05Z")

</div>

It sure looks to me like ::default is meant to be used and attributes  
make the switch.

[https://github.com/opscode-cookbooks/nginx/blob/master/recipes/default.rb#L41-L46](https://github.com/opscode-cookbooks/nginx/blob/master/recipes/default.rb#L41-L46)

Set the attributes and show the logs from your converge, and the stack-trace.

Cheers,

AJ

On 13 June 2013 11:52, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:

> The docs say:
> 
> default.rb: Use this recipe if you have a native package for Nginx.  
> repo.rb: The developer of Nginx also maintain stable packages for several  
> platforms.  
> source.rb: Use this recipe if you do not have a native package for Nginx, or  
> if you want to install a newer version than is available, or if you have  
> custom module compilation needs.
> 
> nginx::default failed on the box I was using, opscode-ubuntu-1204, so I used  
> repo.
> 
> Don't know if it's related, but I'm also using application\_nginx, which  
> creates an entry in sites-enabled:  
> .conf
> 
> On 06/12/2013 02:36 PM, AJ Christensen wrote:
> 
> service[nginx] is provided by a different recipe, not nginx::repo. You  
> probably need nginx::server or nginx::default.
> 
> Cheers,
> 
> AJ
> 
> On 13 June 2013 05:38, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:
> 
> Nic,
> 
> Thanks for your response.
> 
> I tried that but it didn't work. When I included it in my recipe the  
> converge threw an exception
> 
> include\_recipe "nginx::repo"
> 
> nginx\_site "default" do  
> enable false  
> end
> 
> [2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:  
> resource execute[nxdissite default] is configured to notify resource  
> service[nginx] with action reload, but service[nginx] cannot be found in the  
> resource collection. execute[nxdissite default] is defined in  
> /srv/chef/file\_store/cookbooks/nginx/definitions/nginx\_site.rb:32:in `block  
> in from\_file'
> 
> Am I not referencing it correctly?
> 
> I looked in the nginx\_site definition, and that only seems to deal with the  
> ubuntu style of linking sites in the sites-enabled directory -- so this may  
> be a moot point anyway.  
> In this case (I think because it comes from the repo) nginx.conf _also_ is  
> including conf.d/\*.conf. That directory includes a default.conf which is  
> also listening on the same interface and port, so that creates a conflict.
> 
> The default template nginx.conf.erb ends with:  
> include \<%= node['nginx']['dir'] %\>/conf.d/_.conf;  
> include \<%= node['nginx']['dir'] %\>/sites-enabled/_;
> 
> It seems like the two host configuration schemes are colliding. (Or,  
> perhaps, conf.d could be used for other type of configuration includes. But  
> in this case, it has a default site defined.)
> 
> I kinda think this is a bug in the template, but it may be correct for other  
> versions of nginx (it's getting 1.4.1 from the repo).
> 
> In any case, thanks for the suggestion.
> 
> Liam
> 
> On 06/12/2013 08:04 AM, Nic Grayson wrote:
> 
> The upstream nginx cookbook enables the default site. I just call the  
> nginx\_site definition on default to disable it.
> 
> nginx\_site "default" do  
> enable false  
> end
> 
> Nic
> 
> On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher [liamk@numenet.com](mailto:liamk@numenet.com) wrote:
> 
> Hi --
> 
> I'm using the application\_nginx cookbook which includes the nginx  
> cookbook.  
> In my wrapper cookbook I have
> 
> cookbooks/bti\_api/attributes/default.rb:  
> override[:nginx][:default\_site\_enabled] = false
> 
> However, the NGINX default site is still enabled! At the bottom of the  
> nginx.conf file is
> 
> include /etc/nginx/conf.d/_.conf;  
> include /etc/nginx/sites-enabled/_;  
> }
> 
> And conf.d/default.conf exists.
> 
> So, it seems that default\_site\_enabled is being ignored. Is this not  
> the way to turn off the default\_site?
> 
> Possibly relevant info:  
> I'm using the nginx::repo recipe
> 
> The run\_list:
> 
> INFO: Loading cookbooks [application, application\_nginx,  
> application\_python, apt, aws, bti\_api, build-essential, chef\_handler,  
> erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,  
> supervisor, windows, yum]
> 
> The
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
> 
> --  
> Liam Kirsher  
> PGP: [http://liam.numenet.com/pgp/](http://liam.numenet.com/pgp/)
