virtual hosts
Posted by: grittson (---.nott.cable.ntl.com)
Date: December 05, 2007 05:55PM

I am new to WampServer. The installation was very easy and it all seems to be working.
Is it possible to set up virtual hosts, and how is it done?
Thanks

Options: ReplyQuote
Re: virtual hosts
Posted by: rip_pit (---.w82-125.abo.wanadoo.fr)
Date: December 05, 2007 06:16PM

i don't really understand your question !
The virtual host is installed with wamp. Just access it by typing [localhost] in your web browser.
(make sure wamp is running)

Is it that you are calling a "virtual host" ?

---------------------------------------------
XP SP3 - pIV - 3.2Ghz - 1.5Go de ram - Wamp 2.0

Options: ReplyQuote
Re: virtual hosts
Posted by: yfastud (Moderator)
Date: December 05, 2007 06:27PM

Open file httpd.conf in C:\wamp\bin\apache\apache2.2.6\conf and find these lines:

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

Uncomment the second line to become:

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

Then open httpd-vhosts.conf in C:\wamp\bin\apache\apache2.2.6\conf\extra and put in your vh in there; make sure to take out those 2 dummy vh or your server will hang

Restart your wamp to take effect

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: virtual hosts
Posted by: grittson (---.nott.cable.ntl.com)
Date: December 06, 2007 12:03AM

Thanks for you swift help.

Ive set up a vh called 'ls.wwt.co.uk' in the directory
\wamp\www\docs\ls.wwt.co.uk

I have changed the httpd.conf file as suggested to

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
and Ive included the following in the file httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@ls.wwt.co.uk.localhost
DocumentRoot "/www/docs/ls.wwt.co.uk.localhost"
ServerName ls.wwt.co.uk.localhost
ServerAlias www.ls.wwt.co.uk.localhost
ErrorLog "logs/ls.wwt.co.uk.localhost-error_log"
CustomLog "logs/ls.wwt.co.uk.localhost-access_log common"
</VirtualHost>

I have also amended the Hosts file in syatem32/drivers/etc/ to include the line
127.0.0.1 localhost
127.0.0.1 ls.wwt.co.uk

The shame is that it doesnt work adn I get a 'server not found' report.
What have i got wrong?

Thanks again.

Options: ReplyQuote
Re: virtual hosts
Posted by: yfastud (Moderator)
Date: December 06, 2007 12:19AM

Your vh code doesn't compatible w/ your docs root, so you should change as follows:

<VirtualHost *:80>
ServerAdmin webmaster@ls.wwt.co.uk.localhost
DocumentRoot "c:/wamp/www/docs/ls.wwt.co.uk"
ServerName ls.wwt.co.uk.localhost
ServerAlias www.ls.wwt.co.uk.localhost
ErrorLog "c:/wamp/www/docs/ls.wwt.co.uk/logs/ls.wwt.co.uk.localhost-error_log"
CustomLog "c:/wamp/www/docs/ls.wwt.co.uk/logs/ls.wwt.co.uk.localhost-access_log common"
</VirtualHost>

Make sure to have folder logs inside folder ls.wwt.co.uk, and in host file, change as follows:

127.0.0.1 ls.wwt.co.uk.localhost

Restart wamp after change; then in browser, access as follows:

[ls.wwt.co.uk.localhost]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: virtual hosts
Posted by: grittson (---.nott.cable.ntl.com)
Date: December 06, 2007 10:10AM

Thanks for your help. Its not working yet but I travel in hope.

the http-vhosts.conf entry is now

<VirtualHost *:80>
ServerAdmin webmaster@ls.wwt.co.uk.localhost
DocumentRoot "F:/Documents and Settings/Greg Williams/My Documents/wamp/www/docs/ls.wwt.co.uk"
ServerName ls.wwt.co.uk.localhost
ServerAlias www.ls.wwt.co.uk.localhost
ErrorLog "F:/Documents and Settings/Greg Williams/My Documents/wamp/www/docs/ls.wwt.co.uk/logs/ls.wwt.co.uk.localhost-error_log"
CustomLog "F:/Documents and Settings/Greg Williams/My Documents/wamp/www/docs/ls.wwt.co.uk/logs/ls.wwt.co.uk.localhost-access_log common"
</VirtualHost>

I had to correct the path names.

The Hosts entry is

127.0.0.1 localhost
127.0.0.1 ls.wwt.co.uk.localhost

and there is a log directory as follows

F:\Documents and Settings\Greg Williams\My Documents\wamp\www\docs\ls.wwt.co.uk\logs

With these changes in place I get errors on
[localhost]
and
[www.ls.wwt.co.uk.localhost]
and
[ls.wwt.co.uk.localhost]

To get it working again I hash out the include in the httd.conf file.

Sorry that this is such a pain and thanks for your help.

Options: ReplyQuote
Re: virtual hosts
Posted by: yfastud (Moderator)
Date: December 06, 2007 01:19PM

Quote

F:/Documents and Settings/Greg Williams/My Documents/wamp/www/docs/

Is this location your main document root?

To me, it looks like you have an extra folder right after the main document root, so you should have this instead ( notice that it's no folder docs b/w www and ls.wwt.co.uk

F:/Documents and Settings/Greg Williams/My Documents/wamp/www/ls.wwt.co.uk

BTW, try to avoid space in document root, so if possible reinstall wamp on the main drive such as F:/wamp

In addition, when comment out the line, make sure it's no space in front of that line; for example:

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

Instead like this:

# Virtual hosts
[space]Include conf/extra/httpd-vhosts.conf

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides



Edited 1 time(s). Last edit at 12/06/2007 01:20PM by yfastud.

Options: ReplyQuote
Re: virtual hosts
Posted by: trampoline66 (---.dsl.zen.co.uk)
Date: December 06, 2007 10:52PM

So can someone clearly state which files should be changed and how for say this domain name

www.pinkclouds.com

so that the domain correctly resolves to the WAMP server,

Thanks

Options: ReplyQuote
Re: virtual hosts
Posted by: grittson (---.nott.cable.ntl.com)
Date: December 07, 2007 03:17PM

It has taken a week and lots of help from this site and others but at last I have virtual Hosts working now.
Its a success story!
If it is any help to anyone here is how it works for me.

1. In httpd.conf clear the hash to get the entry

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

2. In httpd-vhosts.conf I added the following:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "F:/wamp/www/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "f:/web/wwt.dev/public_html"
ServerName wwt.dev
ErrorLog "f:/web/wwt.dev/www_logs/error_log.txt"
<Directory "f:/web/wwt.dev/public_html">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Of course any other user will have to put in place the directories and files.

3. In the Hosts file I put:

127.0.0.1 localhost
127.0.0.1 wwt.dev
127.0.0.1 www.wwt.dev

If anyone has advice about
a) how it could work better
b) any security issues that this implementation raises
I would be greatful.

Options: ReplyQuote


Sorry, only registered users may post in this forum.