For the most part, I utilize AWS-EC2 to build one site per instance. Even subdomains are usually kept on separate instances. However, lately, I got a project where I would be setting up an instance and adding several different micro sites to one instance, and using a shared database. So, I figure I would need to setup some virtual hosts, which I had not done up to this point. What I found, was that this was very easy. Here’s how!
First thing to do is get into the directory that controls all this stuff.
Next enter this information into a file you create for your domain. So first I would enter
[code]sudo pico mydomain.com[/code]
And they I would enter this information into the file and save it.
# Other directives here
Now you need to load it up into apache by running this.
[code]sudo a2ensite mydomain.com[/code]
And finally reload apache.
[code]sudo /etc/init.d/apache2 reload[/code]