I would like to create a virtual host in apache2, but I want it to place the source files outside the /var/www folder, i.e. I need to include another document root in the config files, but I implemented it by editing the apache/sites-available/default file, but I know its not the right way to implement, can any one suggest the correct way of implementing it?
with thank and regards,
bala
You can create a new file (e.g.
myvirtualhost) in thesites-availablefolder and then create a symlink in thesites-enabled. The file and the symlink can have any name.Inside the new file you create a new virtual host definition:
If you are deploying your application only locally for testing it is enough to set the server name to a .local domain (e.g
abc.local) in this case you should edit the/etc/hostsfile and add a new line like.If you want to make the new virtual host available on the internet you need to make sure that you have registered a valid DNS name with your provider (e.g.
webapplication.mydomain.com).Basically thats it. You may however want to add some directives to the virtual host definition to control access to your resources.