One WAMP Two Sites: How?

Hello there.

I’m doing my experimenting in WAMP, which of course contains the site that I am working on in a folder called WWW.

If I want to start putting together a second site, how do I do that? Make another folder called WWW2 ? Will whatever functions that WAMP has to operate on the website files be able to find them in WWW2?

Or do I rename the first site’s folder WWW1 and make a new folder for WWW? And progressively have a series of WWWx folders for a series of websites, from which I rename off the number to activate one or the other?

I could try it but I’m afraid of blowing up 500 pages that I’ve worked on for years.

Thank you kindly.

Pseu

Hi Pseu,

You typically create a new folder for each website under the www folder. Examples of two sites:

www/abc/index.html
www/def/index.html

Above you have two site folders, abc and def. You could then structure folders inside abc and def:


// Site abc.com
www/abc/
--> css
------>style.css
--> scripts
------>buttons.js
------>gallery.js
index.html
about.html

// Site def.com
www/def/
--> css
------>style.css
--> scripts
------>buttons.js
------>menu.js
index.html
services.html
about.html

You then need to ensure that Wamp is configured to use named hosts. If this is configured then you need to edit the httpd.cof to ensure that your virtualhosts include is active (is not commented out), like:


# Virtual hosts
Include conf/extra/httpd-vhosts.conf

If the vhosts configuration files is enabled then navigate to and open it.

You then create two virtual hosts like this:


<VirtualHost *:80>
    DocumentRoot /var/www/abc
    ServerName www.abc.com
    ServerAlias abc.com

    <Directory "/var/www/abc">
        allow from all
        Options -Indexes
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/def
    ServerName www.def.com
    ServerAlias def.com
    <Directory "/var/www/def">
        allow from all
        Options -Indexes
    </Directory>
</VirtualHost>

Then you need to restart Wamp.

Finally you need to alter your host file windows/system32/etc/hosts


127.0.0.1    abc.com
127.0.0.1    def.com

If you need to find out more, there are hundreds (if not thousands) of tutorials on creating multiple site under WAMP or setting virtual hosts. Google is you friend :slight_smile:

Steve

Here is a good link on how. http://cesaric.com/?p=255

I have mine setup like this http://christianvarga.com/blog/2012/05/vhosts-and-mamp/ very similar to what ServerStorm suggested.

I did not want to move all my websites into the www folder. So I create a virtual site like the above link shows. Basically you just point wamp at wherever your site currently lives. This way you don’t have to move anything.

Yep!

SS has just completed this with a very stubborn member in another thread but his information is spot on!

As for the directory, using any directory on your computer (test server) became the standard with Apache 2.x (it HAD to be in the htdocs folder in Apache 1.x … if I remember correctly). Personally, I keep all my virtual hosts (and other web-related files) on a separate partition (so I can keep it separated from other nonsense - easier to backup all my websites that way).

Regards,

DK