In order to build out my Dev laptop I'm going to setup Apache with virtual hosts, and setup Django to run in a dev mode but behind Apache. This is a hit in time upfront, but should sharpen a few skills on the sysadmin side, make development testing and deployment more straightforward on an ongoing basis. I should consider future project also, so I need to specify the clients as well as the sub-project in the URL.
http://onlamp.com/pub/a/apache/2003/07/24/vhosts.html
So, I'm going to add a few hosts into my laptops host file based name resolver. So using "sudo vi /etc/hosts" I add these as aliases for the IP Apache is listening on.
127.0.1.1 hostname blog.client1.net www.client1.net
I test these out with a browser and they all take me to the same default page served by Apache on port 80. Per:
If Apache has no vhosts, it will use the main server'sBingo. Now to change the behaviour of Apache.DocumentRoot
directory (often set to/var/www/html
).
Within a vhost block--betweenSo using "sudo vi /etc/apache2/apache2.conf", added the following:and
tags in
httpd.conf
--many directives may be given, but only two are typically required: theServerName
and theDocumentRoot
directives. As a matter of good form,vhost blocks and related directives should go at the end of thehttpd.conf
file.
No comments:
Post a Comment