localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 01, 2010 03:59PM

I just moved to a new laptop. My WAMP setup, with several vhosts in addition to localhost, was working fine on my other laptop running Vista. I copied the setup directly to my new laptop running Win7 and set up my hosts file the same as the old one.

My localhost is working... but none of my other vhosts are. Does anyone have any suggestions as to what the problem is?

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: September 01, 2010 04:50PM

U just copied the wamp folder?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: yfastud (Moderator)
Date: September 01, 2010 06:49PM

you might nissed a step or 2 when migrating, so check this


To setup VH, follow this
[blog.jlbn.net]

Have fun,

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

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 01, 2010 07:17PM

@steven, I installed wamp on the new laptop... copied the appropriate config files over (and the MySQL data folder). localhost/phpmyadmin works fine and can see all the tables in my databases. Going to localhost shows the WampServer page. So localhost is working fine. But other vhosts I've set up - projects, jdf.net, d.jdfowler.net, etc. - are not working, even though they are set up in hosts, and httpd-vhosts.conf the same way as localhost.

@yfastud, I've read (and re-read) the steps in the link you offered... I can't see anything that's wrong or missing. Besides, as I said, it's set up the same on this laptop (Win7) as on my old laptop (Vista) - and that was by copying, not by editing, so that eliminates type-os. Is there something different I need to do because of Win7?... or because it's a 64bit system?

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: September 01, 2010 07:42PM

Let's see ur hosts file and vhosts file in the extra folder

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: yfastud (Moderator)
Date: September 01, 2010 07:48PM

Quote

So localhost is working fine. But other vhosts I've set up - projects, jdf.net, d.jdfowler.net, etc. - are not working, even though they are set up in hosts, and httpd-vhosts.conf the same way as localhost.
now you listed the files and it seems you missed step to enable vh sad smiley

Have fun,

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

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 01, 2010 09:23PM

Ok... This is C:\Windows\System32\drivers\etc\hosts


127.0.0.1 localhost

127.0.0.1 projects
127.0.0.1 webs
127.0.0.1 drupal6
127.0.0.1 stfm
127.0.0.1 abt
127.0.0.1 test

127.0.0.1 jdf.com
127.0.0.1 jdf.net
127.0.0.1 d.jdfowler.net
127.0.0.1 old.jdfowler.net

127.0.0.1 litdep.com
127.0.0.1 d.literarydepot.com

127.0.0.1 d.soumpholphakdy.net

127.0.0.1 d.vlfowler.net

------------------------------------------------------

This is C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf

#
# 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.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.localhost
# DocumentRoot "C:/Program Files/Apache Software #Foundation/Apache2.2/docs/dummy-host.localhost"
# ServerName dummy-host.localhost
# ServerAlias www.dummy-host.localhost
# ErrorLog "logs/dummy-host.localhost-error.log"
# CustomLog "logs/dummy-host.localhost-access.log" common
#</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects"
ServerName projects
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs"
ServerName webs
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName drupal6
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects/StoryTime"
ServerName stfm
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects/ABT"
ServerName abt
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName test
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/jdfowler.com"
ServerName jdf.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/jdfowler.net"
ServerName jdf.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.jdfowler.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/LiteraryDepot"
ServerName litdep.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.literarydepot.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.soumpholphakdy.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.vlfowler.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal/Source"
ServerName old.jdfowler.net
</VirtualHost>

-------------------------------------------------------------

Also, in C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf, I have the following line UNcommented...

Include conf/extra/httpd-vhosts.conf

-------------------------------------------------------------

I read in another forum about the lmhosts.sam file (new to Win7, perhaps?). I tried putting an entry there, but it didn't seem to make a difference, so I removed it again.

Btw, thanks for your quick replies here in this thread. It's much appreciated.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: September 01, 2010 09:44PM

jsut do a test of another inside the wamp folder


add

<VirtualHost *:80>
DocumentRoot "C:/wamp/test"
ServerName test
</VirtualHost>



make a folder test in www and and and index.php

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 01, 2010 10:08PM

Steven,

Good idea. I tried this...

1) added the VirtualHost entry as you suggested. The "127.0.0.1 test" was already in my hosts file.
2) made folder C:/wamp/test (first tried C:/wamp/www/test)
3) copied index.php from www to test (added text that says "TEST" so I'll know it's getting the right one)
4) exited wampServer
5) restarted wampServer
6) went to Firefox
7) typed "test"

After a few seconds of "looking for test" it went to google and searched for "test" - which, of course, means it didn't find the local vhost.

Early on while trying to fix this, I was going to the trouble of restarting my laptop each time, but now I just stop (actually "exit"winking smiley and restart wampServer. I assume that should work ok.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: September 02, 2010 05:02AM

u wrote test or h ttp://test?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 09/02/2010 05:34AM by stevenmartin99.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: yfastud (Moderator)
Date: September 02, 2010 05:32AM

all your vh did not work because they're outside main doc root, and you should have as follows:
1. create folder test inside main doc root folder c:/wamp/www
2. inside folder test, create index test file "index.php" or "index.html"
<?php
// index.php
echo "VH works";
?>
<html>
<body>
<!-- index.html -->
<p>VH works</p>
</body>
</html>
3. make sure your host file content this line
127.0.0.1 test
4. in file httpd-vhosts.conf has this part
<VirtualHost *:80>
ServerName test
DocumentRoot "C:/wamp/www/test"
</VirtualHost>
5. restart wamp to take effect
6. in browser, try this 'http://test'

Have fun,

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

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 02, 2010 05:51AM

@steven, I typed just "test". I've never had to type http:// before any of my virtual domains when it worked on Vista. I simply typed test, or d.jdfowler.net, or jdf.net, or projects, or webs, or whatever.

But, I just tried [test] just now. I got a site (on the internet) of test.com. And, as I said, if I just type "test", it searches for that site for several seconds, then defaults to a google search of "test".

@yfastud, I think perhaps you're not reading these posts carefully. I *know* my vhosts are outside the doc root of c:/wamp/www. I don't want to keep all my projects in that folder. But for each vhost, I specify the DocumentRoot explicitly, so it shouldn't matter where they are. And, as I said in the beginning, this setup was working on my Vista laptop (even with the DocRoots outside the wamp/www folder structure.

Re: #1 - I did that (read above)
Re: #2 - I did that (read above)
Re: #3 - It's there (PLEASE read above)
Re: #4 - It's there (PLEASE PLEASE PLEASE READ THE THREAD)
Re: #5 - Did it.
Re: #6 - Never had to type http:// before - tried it anyway just now - it went to test.com online.

Re: Have fun... No, this is not fun at all.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: yfastud (Moderator)
Date: September 02, 2010 01:48PM

I did read and based on your post to answer since people here based on questioner's posts to answer and if you HIDE something and only posted what you wanted to post, then we can NOT really help

Quote

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects"
ServerName projects
</VirtualHost>
Quote

But for each vhost, I specify the DocumentRoot explicitly
I did NOT see any "specify the DocumentRoot explicitly" here
Quote

2) made folder C:/wamp/test (first tried C:/wamp/www/test)
since it did NOT explicitly specify you restart wamp after each edit, so I assume you only restart after c:/wamp/test which is outside main doc root
anyway, make sure your firewall/antivirus or browser addon does NOT reroute your URL
btw, "Have fun," is part of my signature so it's always there in every post I had winking smiley

Have fun,

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



Edited 2 time(s). Last edit at 09/02/2010 02:18PM by yfastud.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: ExTexan (---.austin.res.rr.com)
Date: September 12, 2010 08:32AM

Hi Guys,

I was away for a while on holiday, but now I'm back and still trying to solve my vhost problem. I am posting ALL pertinent files (including reposting ones I posted before), just to make sure you get a snapshot of my current configuration. I still can't help thinking this is somehow a Win7 issue, because this exact setup was working for months (years?) in Vista.

------------------------

First, my httpd.conf file. To save space, I removed all commented lines (#)...

ServerRoot "c:/wamp/bin/apache/apache2.2.11"

Listen 80

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule php5_module "c:/wamp/bin/php/php5.2.9-1/php5apache2_2.dll"


<Directory C:/Users/Doug/Webs/Drupal>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

<Directory C:/Users/Doug/Webs/Drupal-6>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

<Directory C:/Users/Doug/Projects>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

<Directory C:/Users/Doug/Webs>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon

</IfModule>
</IfModule>

ServerAdmin admin@localhost

ServerName localhost:80

DocumentRoot "c:/wamp/www/"

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

<Directory "C:/Users/Doug/Webs">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

<Directory "C:/Users/Doug/Projects">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

# This one is for the tmp folder for Drupal
<Directory "C:/Users/Doug/AppData/Local/Drupal6/tmp">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

<IfModule dir_module>
DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>

ErrorLog "c:/wamp/logs/apache_error.log"

LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

CustomLog "c:/wamp/logs/access.log" common
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "cgi-bin/"
</IfModule>

<IfModule cgid_module>
#Scriptsock logs/cgisock
</IfModule>

<Directory "cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
</IfModule>

Include conf/extra/httpd-autoindex.conf
Include conf/extra/httpd-vhosts.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Include "c:/wamp/alias/*"

--------------------------------------------

Here's my hosts file...

127.0.0.1 localhost
127.0.0.1 test

127.0.0.1 projects
127.0.0.1 webs
127.0.0.1 drupal6
127.0.0.1 stfm
127.0.0.1 abt

127.0.0.1 jdf.com
127.0.0.1 jdf.net
127.0.0.1 d.jdfowler.net
127.0.0.1 old.jdfowler.net

127.0.0.1 litdep.com
127.0.0.1 d.literarydepot.com

127.0.0.1 d.soumpholphakdy.net

127.0.0.1 d.vlfowler.net

---------------------------------

And my httpd-vhosts.conf...

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName test
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects"
ServerName projects
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs"
ServerName webs
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName drupal6
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects/StoryTime"
ServerName stfm
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Projects/ABT"
ServerName abt
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/jdfowler.com"
ServerName jdf.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/jdfowler.net"
ServerName jdf.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.jdfowler.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/LiteraryDepot"
ServerName litdep.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.literarydepot.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.soumpholphakdy.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.vlfowler.net
</VirtualHost>

-----------------------------------------------------

I know not all of these are under C:/wamp/www - I don't want them to be. I want to organize my development files where they make most sense. Not under a catch-all folder in the wamp installation structure. Besides, as I said before... *this* configuration was working fine in Vista (and XP before that).

Also, in previous posts in this thread, the question was asked.... am I typing h ttp://example.com or just example.com. When it was working on my other laptops, I only had to type the URL, not the http:// prefix. For example... d.jdfowler.net - not h ttp://d.jdfowler.net. Just as I can type localhost and it works (even on this new laptop running Win7). But in my testing, I've always tried it both ways just to see if one might work.

Any help with this will be greatly appreciated.



Edited 1 time(s). Last edit at 09/12/2010 08:34AM by ExTexan.

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: September 12, 2010 09:20AM

you have

<VirtualHost *:80>
DocumentRoot "C:/Users/Doug/Webs/Drupal-6"
ServerName d.vlfowler.net
</VirtualHost>

i would have

<VirtualHost *:80>
ServerName d.vlfowler.net
DocumentRoot "C:\ Users\ Doug\ Webs\ Drupal-6"
</VirtualHost>



(servername first and \ instead of / on a windows machine

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: localhost works - other virtual hosts don't
Posted by: yfastud (Moderator)
Date: September 12, 2010 02:40PM

you confuses the server since you should put all dir config in each match vh instead in main config file and as steven pointed out, you have to use forward flashes, not backwards winking smiley

Have fun,

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.