4
votes

I am trying to setup a development environment based on vagrant provisioned with Chef. I created an environment with Apache (used Chef) and can access web server from my host machine with port forwarding.

I'd like to make my vagrant box to contain several virtual hosts and with shared folders I will define different projects pointing out same box and related virtual host.

What I need to learn is whether there is a Chef-way to create virtual hosts for apache (it maybe other web servers, eg. nginx) under vagrant box or not. Or after vagrant+chef setup should I configure virtual hosts manually with connecting box via ssh? If both options are available, which one is more preferable to apply?

1

1 Answers

2
votes

The answer is YES, you can do this using Chef. The choices you have to is to use standard community recipe of Apache2 by Opscode or part of it. You might also want to check discussion here and here

Good practice would be of course to use a recipe/write your own to create virtual hosts and enable them. One of things you want to achieve with Chef is to automate this so that you won't have to do it manually. The complexity of your scenario might demand you to do it differently than what has been tried in links below. You might have to DNS configurations in place of course if you are planning to deploy this places other than your local machine.