Question

I installed Bitnami WAMP Stack in Windows 7 and I am trying to get my eclipse php code to run. I found a link online that said to add an alias, but that didn't work, how do I get the code to run in

http://localhost/greenmugcafe/ 

if my eclipse workspace is located here

C:\Users\Robert\Documents\GitHub\greenmugcafe ?

Edit: I could not find anything on doing this for Bitnami WAMP but I found a few for the Bitnami Django stack.

Any Help at all?

Was it helpful?

Solution

Your code would run from http://localhost/greenmugcafe/ if you changed the virtual host directory of localhost to C:/Users/Robert/Documents/GitHub/

Personally, I think it would be better to create a local domain called greenmugcafe.dev rather than having a folder greenmugcafe in the localhost domain.

How to setup virtual hosts in WAMP

Make sure virtual hosts have been enabled:

  1. Edit /installdir/apache2/conf/httpd.conf
  2. Search for line that includes httpd-vhosts.conf and uncomment it by removing the # at the start

Adding a new virtual host:

  1. Edit the hosts file on your windows system (usually located at C:\WINDOWS\system32\drivers\etc\)
  2. Add the following to the end of the hosts file 127.0.0.1 greenmugcafe.dev. This tells your computer that any url with a value of greenmugcafe.dev should be routed to 127.0.0.1 (aka localhost).
  3. Save the hosts file and now edit this file /installdir/apache2/conf/extra/httpd-vhosts.conf
  4. Add the greenmugcafe.dev virtual host entry at the bototm of the /installdir/apache2/conf/extra/httpd-vhosts.conf file, save, and restart the server.

Here's the code:

#greenmugcafe
<VirtualHost *:80>
  ServerAdmin webmaster@greenmugcafe.dev
  DocumentRoot "C:/Users/Robert/Documents/GitHub/greenmugcafe/"
  ServerName greenmugcafe.dev
    ErrorLog "logs/greenmugcafe.dev-error.log"
    CustomLog "logs/greenmugcafe.dev-access.log" common
  <Directory "C:/Users/Robert/Documents/GitHub/greenmugcafe/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Require all granted
  </Directory>
</VirtualHost>

Now http://greenmugcafe.dev will point to C:/Users/Robert/Documents/GitHub/greenmugcafe/

This method will also work for other WAMP stacks like Wamp Server and XAMPP.

For a launched website on a linux server, instead of the windows host file, we would change the a record of the domain name to point to the server IP address. Then we still need to setup the virtual host so the server knows to recognise the domain name and point it to the correct folder on the server.

Hope that helps :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top