ajoo Posted February 12, 2017 Share Posted February 12, 2017 (edited) Hi all ! I recently learnt a bit of vagrant to set up a VM fast and try out things with it and one of the neat things about vagrant is that it lets me keep my project folder / website folder on the host machine and make changes to it there while I can test out the project from the VM Next I wanted to try and host another site on the same VM so instead of trying it out on the same VM, I thought it would be better to create a clone of the current state of my VM and try out things there. So I made the clone but now I don't know how to change the association of the project folder to another folder on my host machine. Earlier I did that using vagrant init in the project/website folder and that was how the machine was initialised and created and the folder association was automatically made. Now here the clone is already there and pointing to the same project/website folder and I want to change this to a new folder and try and host 2 websites from there. This is the folder in the association in the original VM. vagrant ---www---myproject It is also the same in the clone. But I would like to somehow change this to say vagrant1 ----www --- MP1 | ---- MP2 I have searched the net but to no avail. Please looking to the experts for some help here. Thanks loads !! Edited February 12, 2017 by ajoo Quote Link to comment Share on other sites More sharing options...
requinix Posted February 12, 2017 Share Posted February 12, 2017 For a simple solution, keep your virtualhost conf files on the host machine (eg, vagrant/www/*.conf) and do something like Include /path/to/wherever/*.confin the Apache configuration. Then you can configure each virtualhost however you want, with whatever root you want. Quote Link to comment Share on other sites More sharing options...
ajoo Posted February 12, 2017 Author Share Posted February 12, 2017 Hi requinix, Thanks for that reply. I will try and understand that and implement it and try it out and revert. Meanwhile I have been thinking about this : When creating a VM using vagrant, a folder is created and vagrant init is used to initialize that folder. The project folders are the created Inside that folder. In case of cloning of VM, the cloned VM does not actually have any folder initialized on the host machine ? Would not that be required first after cloning before creating any project folders? If that is required then how to go about it. Thanks. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 12, 2017 Share Posted February 12, 2017 Why do you want to clone the VM for each site? Quote Link to comment Share on other sites More sharing options...
ajoo Posted February 12, 2017 Author Share Posted February 12, 2017 Hi Guru Jacques ! No, I don't want to clone a VM for each site. In fact I just want to use one VM for multiple sites hosting. The cloning is to create a VM so as not to disturb anything on the VM where I have hosted one of the projects successfully. I wanted to learn how to host multiple site on a VM. Hence I cloned a VM from my existing VM state so that I could then test / try out stuff on the cloned VM. Ofocurse the cloned VM does not have any vagrant initialized folder on the host machine and hence my question. Thank you ! Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 12, 2017 Share Posted February 12, 2017 Hosting multiple sites means adding a few lines to the Apache configuration. It doesn't involve any deep changes in the environment. So instead of spending your time on clone initialization, just make a backup of the Apache configuration. Or even better: Put it under version control. Quote Link to comment Share on other sites More sharing options...
ajoo Posted February 12, 2017 Author Share Posted February 12, 2017 Thank you Guru Jacques, I'll accept what you say and get back to my original VM, but just out of curiosity and a desire to learn I would be grateful if you or anyone else can shed light on my original questions ! Thanks loads !! Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 12, 2017 Share Posted February 12, 2017 Like I said, none of us is using Vagrant. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.