Much to my amazment this one is really simple.
Make sure to uncomment or add in:
NameVirtualHost *:80
Since I don't want to add multple IP's to the server and I always want to use port 80 (The default for http).
Then I added
<VirtualHost *:80>
ServerName scorpio.mydomain.local
ServerAlias scorpio
DocumentRoot "/var/www/html"
ServerPath /html/
DirectoryIndex index.php index.htm
</VirtualHost>
<VirtualHost *:80>
ServerName dev.mydomain.local
ServerAlias www.mydowmain.local mydomain.local
DocumentRoot "/var/www/html"
ServerPath /html/
DirectoryIndex index.php index.htm
</VirtualHost>
<VirtualHost *:80>
ServerName dev.myotherdomain.local
ServerAlias www.myotherdowmain.local myotherdomain.local
DocumentRoot "/var/www/html"
ServerPath /html/
DirectoryIndex index.php index.htm
</VirtualHost>
<VirtualHost *:80>
ServerName dev.mythirddomain.local
ServerAlias www.mythirddowmain.local mythirddomain.local
DocumentRoot "/var/www/html"
ServerPath /html/
DirectoryIndex index.php index.htm
</VirtualHost>
When it was all said and done this was pretty easy. Not as easy as doing the same thing in IIS in my opinion but still very easy. I could have tried this with Webmin but I did this all using vi from the CLI.
1 comment:
Nice post. Very clear and simple. I can definitely see this being used by someone who needs to add vhosts to apache. Thanks!
Post a Comment