# apache2 cookbook , cannot seem to disable the default site

**URL:** <https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867>\
**Category:** Chef Infra (archive)\
**Created:** [June 24, 2012, 9:14am UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867 "2012-06-24T09:14:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kobi\_Biton](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kobi_biton/32/696_2.png) [@Kobi\_Biton](https://discourse.chef.io/u/Kobi_Biton)\
**Post date:** [June 24, 2012, 9:14am UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867/1 "2012-06-24T09:14:00Z")

</div>

hi folks i am using the latest apache2 cookbook from opscode to  
configure my apache server I have already added my own virtual hosts  
recipes, for some reason I cannot seem to be able to disable the default  
and default-ssl sites , I red the README and tried apache\_site “default”  
“disable” , apache\_site “default” “false” but nothing seems to trigger  
the a2dissite code.

Any Ideas?

Thanks,  
Kobi

---

<div class="post-metadata">

**Author:** ![Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mike/32/18_2.png) [@Mike](https://discourse.chef.io/u/Mike)\
**Post date:** [June 24, 2012, 12:13pm UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867/2 "2012-06-24T12:13:14Z")

</div>

Hey Kobi,

I ran into that problem, and fixed it here:  
[http://tickets.opscode.com/browse/COOK-1315](http://tickets.opscode.com/browse/COOK-1315)

Basically, it's now an attribute, named `default_site_enabled` with a  
value of true/false.

It has not been released into the cookbook versions yet, should make  
it into 1.1.10.

-M

On Sun, Jun 24, 2012 at 5:14 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:

> hi folks i am using the latest apache2 cookbook from opscode to configure my  
> apache server I have already added my own virtual hosts recipes, for some  
> reason I cannot seem to be able to disable the default and default-ssl sites  
> , I red the README and tried apache\_site "default" "disable" , apache\_site  
> "default" "false" but nothing seems to trigger the a2dissite code.
> 
> Any Ideas?
> 
> Thanks,  
> Kobi

---

<div class="post-metadata">

**Author:** ![Kobi\_Biton](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kobi_biton/32/696_2.png) [@Kobi\_Biton](https://discourse.chef.io/u/Kobi_Biton)\
**Post date:** [June 24, 2012, 12:20pm UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867/3 "2012-06-24T12:20:07Z")

</div>

great, thanks a lot for the ref.

eventually I was able to disable the default site by adding the below  
code to my custom virtual host recipe:

apache\_site "default" do  
enable false  
end

I figured it out from the module disable example on the readme maybe one  
should consider an example snippet on README.rb file?

anyways I am all good now , thanks!

Kobi.

On 06/24/2012 03:13 PM, Mike wrote:

> Hey Kobi,
> 
> I ran into that problem, and fixed it here:  
> [http://tickets.opscode.com/browse/COOK-1315](http://tickets.opscode.com/browse/COOK-1315)
> 
> Basically, it's now an attribute, named `default_site_enabled` with a  
> value of true/false.
> 
> It has not been released into the cookbook versions yet, should make  
> it into 1.1.10.
> 
> -M
> 
> On Sun, Jun 24, 2012 at 5:14 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:
> 
> > hi folks i am using the latest apache2 cookbook from opscode to configure my  
> > apache server I have already added my own virtual hosts recipes, for some  
> > reason I cannot seem to be able to disable the default and default-ssl sites  
> > , I red the README and tried apache\_site "default" "disable" , apache\_site  
> > "default" "false" but nothing seems to trigger the a2dissite code.
> > 
> > Any Ideas?
> > 
> > Thanks,  
> > Kobi

---

<div class="post-metadata">

**Author:** ![Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mike/32/18_2.png) [@Mike](https://discourse.chef.io/u/Mike)\
**Post date:** [June 24, 2012, 12:25pm UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867/4 "2012-06-24T12:25:02Z")

</div>

Glad to hear you got it.

I wanted to minimize the amount of apache reconfiguration done on each  
chef run, and since a reconfig triggers an apache reload, I wanted to  
prevent that as much as possible as well.  
As well as make it configurable outside the cookbook itself, to  
maintain a "pristine" installed cookbook.

Curious - does this mean that on a chef run, you're enabling the  
default in apache2::default and the disabling in your custom recipe?

-M

On Sun, Jun 24, 2012 at 8:20 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:

> great, thanks a lot for the ref.
> 
> eventually I was able to disable the default site by adding the below code  
> to my custom virtual host recipe:
> 
> apache\_site "default" do  
> enable false  
> end
> 
> I figured it out from the module disable example on the readme maybe one  
> should consider an example snippet on README.rb file?
> 
> anyways I am all good now , thanks!
> 
> Kobi.
> 
> On 06/24/2012 03:13 PM, Mike wrote:
> 
> > Hey Kobi,
> > 
> > I ran into that problem, and fixed it here:  
> > [http://tickets.opscode.com/browse/COOK-1315](http://tickets.opscode.com/browse/COOK-1315)
> > 
> > Basically, it's now an attribute, named `default_site_enabled` with a  
> > value of true/false.
> > 
> > It has not been released into the cookbook versions yet, should make  
> > it into 1.1.10.
> > 
> > -M
> > 
> > On Sun, Jun 24, 2012 at 5:14 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:
> > 
> > > hi folks i am using the latest apache2 cookbook from opscode to configure  
> > > my  
> > > apache server I have already added my own virtual hosts recipes, for some  
> > > reason I cannot seem to be able to disable the default and default-ssl  
> > > sites  
> > > , I red the README and tried apache\_site "default" "disable" ,  
> > > apache\_site  
> > > "default" "false" but nothing seems to trigger the a2dissite code.
> > > 
> > > Any Ideas?
> > > 
> > > Thanks,  
> > > Kobi

---

<div class="post-metadata">

**Author:** ![Kobi\_Biton](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kobi_biton/32/696_2.png) [@Kobi\_Biton](https://discourse.chef.io/u/Kobi_Biton)\
**Post date:** [June 24, 2012, 12:28pm UTC](https://discourse.chef.io/t/apache2-cookbook-cannot-seem-to-disable-the-default-site/2867/5 "2012-06-24T12:28:47Z")

</div>

Yes you are right I am running the chef::default and then my custom  
recipe disabling the default site , by all means its not an elegant  
workaround but it works 😉 , I will have to wait for the new attribute  
on 1.1.10 ... 🙂 this will enable me to remove my code snippet.

Kobi.

On 06/24/2012 03:25 PM, Mike wrote:

> Glad to hear you got it.
> 
> I wanted to minimize the amount of apache reconfiguration done on each  
> chef run, and since a reconfig triggers an apache reload, I wanted to  
> prevent that as much as possible as well.  
> As well as make it configurable outside the cookbook itself, to  
> maintain a "pristine" installed cookbook.
> 
> Curious - does this mean that on a chef run, you're enabling the  
> default in apache2::default and the disabling in your custom recipe?
> 
> -M
> 
> On Sun, Jun 24, 2012 at 8:20 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:
> 
> > great, thanks a lot for the ref.
> > 
> > eventually I was able to disable the default site by adding the below code  
> > to my custom virtual host recipe:
> > 
> > apache\_site "default" do  
> > enable false  
> > end
> > 
> > I figured it out from the module disable example on the readme maybe one  
> > should consider an example snippet on README.rb file?
> > 
> > anyways I am all good now , thanks!
> > 
> > Kobi.
> > 
> > On 06/24/2012 03:13 PM, Mike wrote:
> > 
> > > Hey Kobi,
> > > 
> > > I ran into that problem, and fixed it here:  
> > > [http://tickets.opscode.com/browse/COOK-1315](http://tickets.opscode.com/browse/COOK-1315)
> > > 
> > > Basically, it's now an attribute, named `default_site_enabled` with a  
> > > value of true/false.
> > > 
> > > It has not been released into the cookbook versions yet, should make  
> > > it into 1.1.10.
> > > 
> > > -M
> > > 
> > > On Sun, Jun 24, 2012 at 5:14 AM, Kobi Biton [kobi.biton@gmail.com](mailto:kobi.biton@gmail.com) wrote:
> > > 
> > > > hi folks i am using the latest apache2 cookbook from opscode to configure  
> > > > my  
> > > > apache server I have already added my own virtual hosts recipes, for some  
> > > > reason I cannot seem to be able to disable the default and default-ssl  
> > > > sites  
> > > > , I red the README and tried apache\_site "default" "disable" ,  
> > > > apache\_site  
> > > > "default" "false" but nothing seems to trigger the a2dissite code.
> > > > 
> > > > Any Ideas?
> > > > 
> > > > Thanks,  
> > > > Kobi
