# Need help with apache2 cookbook

**URL:** <https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172>\
**Category:** Chef Infra (archive)\
**Created:** [March 27, 2014, 1:08am UTC](https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172 "2014-03-27T01:08:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_Sani](https://avatars.discourse-cdn.com/v4/letter/w/a9adbd/32.png) [@William\_Sani](https://discourse.chef.io/u/William_Sani)\
**Post date:** [March 27, 2014, 1:08am UTC](https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172/1 "2014-03-27T01:08:55Z")

</div>

Hi,

I’m an infant with this stuff. I have a site.rb file, which has the following:

web\_app “[site.com](http://site.com)” do  
server\_name "[site.com](http://site.com)"  
server\_aliases [“[www.site.com](http://www.site.com)” ]  
docroot "/var/www/vhosts/site.com"  
end

I have two questions:

1. How do I actually get this site recipe to generate the SSL config for the  
virtual host?
2. I defined docroot path, which I thought chef would create the directory for  
me, but alas, it didn’t. Do I need to create it on manually, or am I doing it  
incorrectly?

There is a likely chance that I’m a total idiot, and I’m doing a lot of things  
incorrectly, so please bear with my noobie questions.

Thanks.

---

<div class="post-metadata">

**Author:** ![methodx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/methodx/32/352_2.png) [@methodx](https://discourse.chef.io/u/methodx)\
**Post date:** [March 30, 2014, 3:06am UTC](https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172/2 "2014-03-30T03:06:35Z")

</div>

Hello to you.

1. Use mod\_ssl recipe for it. It will turn on 443 port.
2. As I can see, it will not create directory. You need to create it separately.

On Thu, Mar 27, 2014 at 5:08 AM, [williamsani@hotmail.com](mailto:williamsani@hotmail.com) wrote:

> Hi,
> 
> I'm an infant with this stuff. I have a site.rb file, which has the following:
> 
> web\_app "[site.com](http://site.com)" do  
> server\_name "[site.com](http://site.com)"  
> server\_aliases ["[www.site.com](http://www.site.com)" ]  
> docroot "/var/www/vhosts/site.com"  
> end
> 
> I have two questions:
> 
> 1. How do I actually get this site recipe to generate the SSL config for the  
> virtual host?
> 2. I defined docroot path, which I thought chef would create the directory for  
> me, but alas, it didn't. Do I need to create it on manually, or am I doing it  
> incorrectly?
> 
> There is a likely chance that I'm a total idiot, and I'm doing a lot of things  
> incorrectly, so please bear with my noobie questions.
> 
> Thanks.

--  
Best regards,  
Egor  
[http://aylium.net](http://aylium.net)

---

<div class="post-metadata">

**Author:** ![William\_Sani](https://avatars.discourse-cdn.com/v4/letter/w/a9adbd/32.png) [@William\_Sani](https://discourse.chef.io/u/William_Sani)\
**Post date:** [March 30, 2014, 7:43pm UTC](https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172/3 "2014-03-30T19:43:08Z")

</div>

Thanks!

1. I did use mod\_ssl, but I want to enable SSL for specific virtual hosts  
(e.g. \*:443 instead of \*:80).
2. Fair enough. I just added this to the function, but curious to know why  
the virtual host directory is not checked for, or created.

William

-----Original Message-----  
From: Egor Medvedev [[mailto:methodx@aylium.net](mailto:methodx@aylium.net)]  
Sent: Saturday, March 29, 2014 8:07 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com); [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Need help with apache2 cookbook

Hello to you.

1. Use mod\_ssl recipe for it. It will turn on 443 port.
2. As I can see, it will not create directory. You need to create it  
separately.

On Thu, Mar 27, 2014 at 5:08 AM, [williamsani@hotmail.com](mailto:williamsani@hotmail.com) wrote:

> Hi,
> 
> I'm an infant with this stuff. I have a site.rb file, which has the  
> following:
> 
> web\_app "[site.com](http://site.com)" do  
> server\_name "[site.com](http://site.com)"  
> server\_aliases ["[www.site.com](http://www.site.com)" ]  
> docroot "/var/www/vhosts/site.com"  
> end
> 
> I have two questions:
> 
> 1. How do I actually get this site recipe to generate the SSL config  
> for the virtual host?
> 2. I defined docroot path, which I thought chef would create the  
> directory for me, but alas, it didn't. Do I need to create it on  
> manually, or am I doing it incorrectly?
> 
> There is a likely chance that I'm a total idiot, and I'm doing a lot  
> of things incorrectly, so please bear with my noobie questions.
> 
> Thanks.

--  
Best regards,  
Egor  
[http://aylium.net](http://aylium.net)

---

<div class="post-metadata">

**Author:** ![methodx](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/methodx/32/352_2.png) [@methodx](https://discourse.chef.io/u/methodx)\
**Post date:** [April 1, 2014, 6:28pm UTC](https://discourse.chef.io/t/need-help-with-apache2-cookbook/5172/4 "2014-04-01T18:28:37Z")

</div>

1. Hmm, for non-standard port, you should check LWRP, or just create  
wrapper cookbook.
2. I think, in some cases authors allow you to install apache2, but  
not create directory, because you should create it with your  
application cookbook. Just a concept.

On Sun, Mar 30, 2014 at 11:43 PM, William Sani [williamsani@hotmail.com](mailto:williamsani@hotmail.com) wrote:

> Thanks!
> 
> 1. I did use mod\_ssl, but I want to enable SSL for specific virtual hosts  
> (e.g. \*:443 instead of \*:80).
> 2. Fair enough. I just added this to the function, but curious to know why  
> the virtual host directory is not checked for, or created.
> 
> William
> 
> -----Original Message-----  
> From: Egor Medvedev [[mailto:methodx@aylium.net](mailto:methodx@aylium.net)]  
> Sent: Saturday, March 29, 2014 8:07 PM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com); [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] Re: Need help with apache2 cookbook
> 
> Hello to you.
> 
> 1. Use mod\_ssl recipe for it. It will turn on 443 port.
> 2. As I can see, it will not create directory. You need to create it  
> separately.
> 
> On Thu, Mar 27, 2014 at 5:08 AM, [williamsani@hotmail.com](mailto:williamsani@hotmail.com) wrote:
> 
> > Hi,
> > 
> > I'm an infant with this stuff. I have a site.rb file, which has the  
> > following:
> > 
> > web\_app "[site.com](http://site.com)" do  
> > server\_name "[site.com](http://site.com)"  
> > server\_aliases ["[www.site.com](http://www.site.com)" ]  
> > docroot "/var/www/vhosts/site.com"  
> > end
> > 
> > I have two questions:
> > 
> > 1. How do I actually get this site recipe to generate the SSL config  
> > for the virtual host?
> > 2. I defined docroot path, which I thought chef would create the  
> > directory for me, but alas, it didn't. Do I need to create it on  
> > manually, or am I doing it incorrectly?
> > 
> > There is a likely chance that I'm a total idiot, and I'm doing a lot  
> > of things incorrectly, so please bear with my noobie questions.
> > 
> > Thanks.
> 
> --  
> Best regards,  
> Egor  
> [http://aylium.net](http://aylium.net)

--  
Best regards,  
Egor  
[http://aylium.net](http://aylium.net)
