Setting up local dev environment
I’m posting this more for future reference in case I need it again, but maybe it will help someone out there.
I’ve been working on setting up my development environment tonite the way that I want it (and can you believe I even turned the tv off … 😯 but it will be turned back on in about 20 min so I can watch GH on SoapNet … I love having that channel … but I digress … ). I wanted to set everything up once right and not have to do it again.
Since I’m running locally, I needed to use http://localhost to access my stuff. But what about subdomains? And what about different main domains? For example, I wanted to set up the Avalanche site so I could work on that and a dev version of this site and a dev version of a new site I’m planning. But I didn’t want to have to do http://localhost/avalanchecountry or whatever. I wanted to be able to do http://avalanchecountry and get to my local copy.
I did a little searching online and found out how to set up a Virtual Host for my local dev environment. And I already new how to add entries to my HOSTS file. The following is what I needed to do to be able to use http://avalanchecountry to access my local dev version …
Add the following to the HOSTS file:
127.0.0.1 avalanchecountry
Add the following to the httpd.conf file:
ServerName localhost
DocumentRoot "C:/websites/public_html"
DirectoryIndex index.php index.html index.html index.htm index.shtml
ServerName avalanchecountry
DocumentRoot "C:/websites/public_html/avalanchecountry"
DirectoryIndex index.php index.html index.html index.htm index.shtml
And to set up a subdomain, just a little tweak …
Add the following to the HOSTS file:
127.0.0.1 design.hightechredneckwoman
Add the following to the httpd.conf file:
ServerName design.hightechredneckwoman
DocumentRoot "C:/websites/public_html/design"
DirectoryIndex index.php index.html index.html index.htm index.shtml
Then stop and restart Apache. And all is happy happy. Woohoo! Now I can spend the weekend working on my own websites for a change. I haven’t done that in WAY too long. It’s time to think about ME for a change. :G-razz3: