Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 06, 2007 12:51PM

Can some one tell is they have gotten vhost_aliass to wor in using WAMP1.70?

I want to setup subdomains and other domains, can someone please provide detail instructions on how to do this.

Thanks in advance.

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: yfastud (---.mia.bellsouth.net)
Date: April 06, 2007 06:06PM

Sure does, have to edit both httpd and httpd-vhosts. To be exact, uncomment to enable vh in httpd; then, put your vh config in httpd-vhosts. If you still have no clue, follow these simple steps

Open httpd.conf and find this line

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

And change it to:

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

Then open httpd-vhosts, and go to the end of the file to insert the following

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.your_domain_here.com
ServerAlias your_domain_here.com
DocumentRoot C:/wamp/www/your_domain_here
</VirtualHost>

Remember to create folder your_domain_here in C:/wamp/www/ and must have index file in there.

Most important is you must restart your server after any change to take effect.

Have fun,

[www.jlbn.com] (testing WAMPS on Vista)
[test.jlbn.com] (testing codes on Vista)

Win Vista Business
Apache 2.2.4
MySQL 5.2.3 F-A
PHP 5.2.1
SSL 0.9.8D

phpMyAdmin 2.10.0.2

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 06, 2007 07:41PM

Okay I tired that and apache doesnt start now, do i have to disable the alias_mod and user_mod for it to work, I read some where sith those enabled they override the vhost_host

what I am trying to do is setup subdomains on 1 machine to test so like this

subdomain.localhost
subdomain2.localhost

and on a production server on another machine

www.domain.com
subdomain.domain.com
subdomain2.domain.com

Just like you have on your Vista box, I am using Vista as well.

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: techno_man (---.20-57-74.mc.videotron.ca)
Date: April 06, 2007 08:19PM

okay from what i know (this is just my oppinion) have you thought about www.zoneedit.com.... they first of all allow you to do exactly what your asking on ur own and you wont need to set it on wamp and itll be less confussing, this is just my oppion on what i see and from my experiances, this would be a good route also if your interestted !

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 06, 2007 09:20PM

That sounds all fine and good but still have to get working right on the WAMP first correct before that can come into play.

I want to test it locally first with subdomains locally before doing anything like that.

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: yfastud (---.mia.bellsouth.net)
Date: April 06, 2007 10:26PM

Quote

have you thought about www.zoneedit.com....
It's not just thought but I'm actually using zoneedit and hosting more than 50 subs on my servers right now

Quote

www.domain.com
subdomain.domain.com
subdomain2.domain.com
This is correct way

Quote

subdomain.localhost
subdomain2.localhost
... but this is not. On the other words, in order to have some sub-domains, you must have a real domain.

Have fun,

[www.jlbn.com] (testing WAMPS on Vista)
[test.jlbn.com] (testing codes on Vista)

Win Vista Business
Apache 2.2.4
MySQL 5.2.3 F-A
PHP 5.2.1
SSL 0.9.8D

phpMyAdmin 2.10.0.2

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 06, 2007 11:28PM

I had read some where yuo could have subdomains on a localhost by editing the hosts file in the /windows/system32/drivers/etc folder

I have added several here to be able to do this. However they all work but all link to the same directory. example


here is my hosts file contents

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 www.localhost
127.0.0.2 www1.localhost
127.0.0.3 www2.localhost
127.0.0.4 www3.localhost
127.0.0.5 www4.localhost
127.0.0.6 www5.localhost
127.0.0.7 www6.localhost
127.0.0.8 www7.localhost
127.0.0.9 www8.localhost

However I can browse to that any of those in my internet browser but it all goes to the same folder as regular localhost.

So I know I am not setting thing up right in httpd.conf or something.
If I uncomment the httpd-vhost.conf file and restart apache it doesnt restart.

so I added directly to the bottom of my httpd.conf file and restarted apache and its works but again all goes to the same folder.

here is what I have on that.

NameVirtualHost 127.0.0.2:80

<VirtualHost 127.0.0.2:80>
# ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "g:/work/www/www1"
ServerName www1.localhost
ServerAlias www1.localhost
# ErrorLog G:/work/www/www1/logs/dummy-host.localhost-error_log
# CustomLog g:/work/www/www1/logs/dummy-host.localhost-access_log common

<Directory "g:/work/www/www1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Any ideas on why its not going to the right diretory?

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 07, 2007 06:23AM

hey All this is what I have found still havent gotten it to work yet.

[opinion.harrybailey.co.uk]

Adding subdomain.localhost when developing
When I was developing the new look for this site I wanted to change several sections of the site from folders to subdomains. Developing locally is much simpler than constantly uploading and checking your work online so I knew I would have to find a better way of developing locally with subdomains than to pretend that the localhost/folder/ was actually folder.localhost. After many hours of finding bits and bobs in various articles hidden away I managed to piece it all together and get it working. Here I share the steps.

Before you take any of the following steps be sure to backup all the files you are about to edit. No responsibility whatsoever is taken for problems arising from you following my instructions. These steps worked for me but I am not garenteeing that they will work for you.

At the time of writing this article I ran
Windows XP Pro
Apache 1.3.28
php 4.3.3

To add subdomain.localhost to your local development arsenal you need to take the following steps:

1) Edit your httpd.conf file to say the following:

<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot C:serverApachehtdocssite
DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

<VirtualHost 127.0.0.2>
ServerName subdomain.localhost
DocumentRoot C:serverApachehtdocssitesubdomain
DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

Obviously you can change the subdomain name to anything you like.
IF you are an expert then you can also change localhost, and if you have several sites running the numbers do not have to be 127.0.0.1/2 as when you follow the next step you can add any IP you like.
Save and exit the httpd.conf file.

2) Edit C:windowssystem32driversetchosts
This file appears on the drive you run windows on. It may be in c:WINXP.... Be sure to use a plain text editor as you don't want to add any text formatting by mistake. Add the line
127.0.0.2 subdomain subdomain.localhost
after the
127.0.0.1 localhost
line.
If you are using several sites then they should all be listed in this file, allowing you to access them just using your servernames that you have set for them in httpd.conf. In my case I edited the file and added the following:

127.0.0.13 harrybailey
127.0.0.14 opinion opinion.harrybailey

Save and exit hosts.

Restart apache. Go to subdomain.localhost in your chosen browser.
At this point you should be seeing the index page of your localhost/subdomain folder. If not then go back and check the instructions to make sure you haven't made any mistakes.

Good luck.

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: techno_man (---.20-57-74.mc.videotron.ca)
Date: April 07, 2007 03:51PM

*** yfastud *** yes i agree that ---- > www.zoneedit.com <----- is 1 of the best to have as many subdomains as you wish for free, instead of playing around with wamp, it would be so easier for you to just use them as your canal for subdomains also you wouldnt screw anything up on your wamp side !

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: CyberSpatium (71.237.217.---)
Date: April 07, 2007 04:37PM

fastburst wrote:

> 2) Edit C:windowssystem32driversetchosts
> This file appears on the drive you run windows on. It may be in
> c:WINXP.... Be sure to use a plain text editor as you don't
> want to add any text formatting by mistake. Add the line
> 127.0.0.2 subdomain subdomain.localhost
> after the
> 127.0.0.1 localhost
> line.
> If you are using several sites then they should all be listed
> in this file, allowing you to access them just using your
> servernames that you have set for them in httpd.conf. In my
> case I edited the file and added the following:
>
> 127.0.0.13 harrybailey
> 127.0.0.14 opinion opinion.harrybailey

any changes you make to your host file will only be usable by you. so, not one else will be able to access your server using your subdomain. if you want others to be able access your server using a subdomain,skip this step find a dynamic dns services that offers subddomains.




CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Please visit my latest website Clarify Loans:
clarifyloans.com

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: yfastud (72.236.169.---)
Date: April 09, 2007 02:33PM

One step at the time, buddy.

First, setup to run everything by default and make sure to test it run as expected; then, edit to meet your needs. Right now, I see at least 3 in your codes are not default.

Have fun,

[www.jlbn.com] (testing WAMPS on Vista)
[test.jlbn.com] (testing codes on Vista)

Win Vista Business
Apache 2.2.4
MySQL 5.2.3 F-A
PHP 5.2.1
SSL 0.9.8D

phpMyAdmin 2.10.0.2

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 09, 2007 05:42PM

I totally agree everyone. I have gotten WAMP setup the way I want and need. My next step is to get localhost with subdomains. I have searched my forums and looked over hte web and said it can indeed be done by editing the hosts file.
I have done that and have created about 10 different subdomains for localhost.

However now I need to setup WAMP to point correctly to the subdomains now.

This is where I am having problems. I think itis because I have it setup on a Windows VISTA box, well ALL my boxes are VISTA.

I need to setup WAMP to be able to point correctly to my subdomains on localhost example

127.0.0.2 www1.localhost
127.0.0.3 www2.localhost

etc etc

AS it is right now any of these I bring up in my internet browser all go to regular localhost instead of the respective paths.

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: yfastud (72.236.169.---)
Date: April 09, 2007 06:12PM

I'm using win vista, too and my local domains/sub-domains working just fine as expected, and already mentioned, you have at least 3 things that are not default, so that's why it causes a confusion for you to figure out which one is the cause, so my suggestion is trying everything by default first, then edit to meet your needs after successful.

BTW, those 3 things are address in hosts file, address in vh and document root.

Have fun,

[www.jlbn.com] (testing WAMPS on Vista)
[test.jlbn.com] (testing codes on Vista)

Win Vista Business
Apache 2.2.4
MySQL 5.2.3 F-A
PHP 5.2.1
SSL 0.9.8D

phpMyAdmin 2.10.0.2

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 09, 2007 07:54PM

I have set everythign to defaults and gotten all of it to work for just localhost and all works fine, now I am tweeking WAMP to see how I can get the subdomains to work with a localhost like I have read all over the internet. I am not going to place a real or live domain until i am possitive that this will work with my subdomains first. If it doesnt work for me locally no way im going live with it. make sense. Iam sure it works perfect for live or an actualy domain as I see it does on yours yfastud, but I do not wnat to chance it on mine yet.


Okay lets address them to see what I have wrong.

hosts file

127.0.0.1 localhost www.locahost
127.0.0.2 www1.localhost
127.0.0.3 www2.localhost
127.0.0.4 www3.localhost
127.0.0.5 www4.localhost
127.0.0.6 www5.localhost
127.0.0.7 www6.localhost
127.0.0.8 www7.localhost
127.0.0.9 www8.localhost

or should these be example 127.0.0.1 www1 www1.localhost ???

I was told and found that I could have as many as I wanted for localhost as listed above.

I dont see an error here. I could be wrong, please point them out if i did.

My document roots work fine as I have everything set to my G: drive.

WAMP installed on G:\WAMP
Document roots for all HTTP docs G:\work
base inital setup is G:\work\www
all subdomains are G:\work\www1
etc etc.

I don't see any issues here as the localhost and all my projects work perfectly fine here. I can alias to any of the www folders fine using [localhost] etc etc

I dont want to alias like that wat to be able to setup subdomains.


now vh This is where i believe my errors are and I believe is where the problem lies.

I got virtual host as below:

NameVirtualHost 127.0.0.2:80
<VirtualHost 127.0.0.2:80>
DocumentRoot "g:/work/www1"
ServerName www1.localhost
ServerAlias www1.localhost

<Directory "g:/work/www1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

still hasnt worked

I even tried this

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "g:/work/www1"
ServerName www1.localhost
ServerAlias www1.localhost

<Directory "g:/work/www1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: fastburst (---.tc.ph.cox.net)
Date: April 09, 2007 08:21PM

HAHAHAHAHA I got it to work with LOCALHOST SUBDOMAINS!

Here is what needed to be changed.

hosts file
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost www www.localhost
127.0.0.2 www1 www1.localhost
127.0.0.3 www2 www2.localhost
127.0.0.4 www3 www3.localhost
127.0.0.5 www4 www4.localhost
127.0.0.6 www5 www5.localhost
127.0.0.7 www6 www6.localhost

and the other file in the vhost-conf

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:[httpd.apache.org];
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

NameVirtualHost 127.0.0.2:80
<VirtualHost 127.0.0.2:80>
# #ServerAdmin webmaster@dummy-host.localhost
DocumentRoot g:/work/www1
ServerName www1.localhost:80
ServerAlias www1.localhost
#ErrorLog G:/work/www/www1/logs/dummy-host.localhost-error_log
#CustomLog g:/work/www/www1/logs/dummy-host.localhost-access_log common

<Directory "g:/work/www1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

NameVirtualHost 127.0.0.3:80
<VirtualHost 127.0.0.3:80>
# #ServerAdmin webmaster@dummy-host.localhost
DocumentRoot g:/work/www2
ServerName www2.localhost:80
ServerAlias www2.localhost
#ErrorLog G:/work/www/www1/logs/dummy-host.localhost-error_log
#CustomLog g:/work/www/www1/logs/dummy-host.localhost-access_log common

<Directory "g:/work/www2">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

NameVirtualHost 127.0.0.4:80
<VirtualHost 127.0.0.4:80>
# #ServerAdmin webmaster@dummy-host.localhost
DocumentRoot g:/work/www3
ServerName www3.localhost:80
ServerAlias www3.localhost
#ErrorLog G:/work/www/www1/logs/dummy-host.localhost-error_log
#CustomLog g:/work/www/www1/logs/dummy-host.localhost-access_log common

<Directory "g:/work/www3">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

restarted WAMP works perfectly now. WOOHOO!
Thanks yfastud!

Options: ReplyQuote
Re: Setup vhost_alias???
Posted by: yfastud (72.236.169.---)
Date: April 09, 2007 08:43PM

You're welcome any time

Have fun,

[www.jlbn.com] (testing WAMPS on Vista)
[test.jlbn.com] (testing codes on Vista)

Win Vista Business
Apache 2.2.4
MySQL 5.2.3 F-A
PHP 5.2.1
SSL 0.9.8D

phpMyAdmin 2.10.0.2

Options: ReplyQuote


Sorry, only registered users may post in this forum.