Sunday, December 28, 2014

Configuring subdomains on WAMP

I just spent 3+ hours trying to set up my DEV environment on a new machine... can't remember how I did it before other than installing each component one by one.

Started with that but for some reason they wouldn't play nice so after 2 hours... I uninstalled everything and just downloaded WAMP. Quick and easy... sort of.

After spending another 30 minutes trying to setup an instance of Yii, which apparently also changed a lot since my last use...

Finally, got to setting up the subdomain because I don't like typing the super-long URL needed to access the front page. Also the application should really be run from a root address anyway... I remember things possibly screw up when migrating to a Production server, otherwise.

http://blog.smriyaz.com/how-to-create-virtual-hosts-in-windows-wamp-server/

This site has a pretty good walk-through except:


- As of Windows 8, I don'r remember having this issue in Windows 7, the host file is completely locked, even elevating Notepad++ to Admin cannot save it. You need to save it to a new path and then manually copy it back into the folder


- This code is not exactly correct and it took me a while to realize it.

The highlighted text should be mydomain.localhost

NameVirtualHost 127.0.0.1  

<VirtualHost 127.0.0.1>
DocumentRoot "c:/wamp/www"
ServerName localhost
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "c:/wamp/www/mydomain.local"
ServerName mydomain.local
</VirtualHost>

No comments:

Post a Comment