creating virtual hosts on a vagrant box

孤人 提交于 2019-12-04 09:59:09

问题


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:


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.



来源:https://stackoverflow.com/questions/11560975/creating-virtual-hosts-on-a-vagrant-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!