You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by kurt miller <mi...@yahoo.com> on 2006/08/05 19:31:41 UTC

[users@httpd] Virtual hosting - 2.2.2 - XP

I'm fairly new to this so I hope my explanation is
clear enough.

I am developing multiple sites. The scenario I'm
trying to create is one 
where I can access each site internally (localhost)
for development AND 
simultaneously allow external clients to preview the
production site 
(separate directory) from my dynamic ip resolver
(www.xxx.dynalias.com).

Thusfar, I am able to successfully map to the local
development sites 
using virtual hosting and my hosts file. The problem I
am struggling 
with is how to map the www.xxx.dynalias.com to more
than one site. Is 
this even possible? As in www.xxx.dynalias.com/site1
or 
www.xxx.dynalias.com/site2 etc.


Here is my current config:

#
# Virtual Hosts
#

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "d:/xampp/xampp/htdocs"
<Directory "d:/xampp/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName cvw.local
DocumentRoot "d:/webdev"
<Directory "d:/webdev">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName sfgh.local
DocumentRoot "d:/SFGHWeb"
<Directory "d:/SFGHWeb">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.xxx.dynalias.com
DocumentRoot "c:/web"
<Directory "c:/web">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

========================
My hosts file:

127.0.0.1 www.xxx.dynalias.com
127.0.0.1 xampp.local
127.0.0.1 cvw.local
127.0.0.1 sfgh.local
127.0.0.1 localhost

Thanks,
Kurt Miller


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual hosting - 2.2.2 - XP

Posted by Alain Wolf <wo...@k18.ch>.
I did the following for my development environment, with customer preview:

---
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so

<Directory "d:/work/*/public_html">
    Options All MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

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

<VirtualHost *:80>
    # '%1' means, include the first part of the server name in the
filenames used to satisfy requests
        ServerAdmin webmaster@example.dyndns.org
        VirtualDocumentRoot d:/work/%1/public_html
        VirtualScriptAlias d:/work/%1/cgi-bin
</VirtualHost>
---

I enabled wildcards in my example.dyndns.org record.

Now for every new project, all I had to do was creating the directory
"project/public_html" in "d:\work", and the site was immeditely
accessible as  http://projectname.example.dyndns.org

Welcome
Alain Wolf

kurt miller wrote:
> I'm fairly new to this so I hope my explanation is
> clear enough.
>
> I am developing multiple sites. The scenario I'm
> trying to create is one 
> where I can access each site internally (localhost)
> for development AND 
> simultaneously allow external clients to preview the
> production site 
> (separate directory) from my dynamic ip resolver
> (www.xxx.dynalias.com).
>
> Thusfar, I am able to successfully map to the local
> development sites 
> using virtual hosting and my hosts file. The problem I
> am struggling 
> with is how to map the www.xxx.dynalias.com to more
> than one site. Is 
> this even possible? As in www.xxx.dynalias.com/site1
> or 
> www.xxx.dynalias.com/site2 etc.
>
>
> Here is my current config:
>
> #
> # Virtual Hosts
> #
>
> NameVirtualHost *:80
>
> <VirtualHost *:80>
> DocumentRoot "d:/xampp/xampp/htdocs"
> <Directory "d:/xampp/xampp/htdocs">
> Options Indexes FollowSymLinks Includes ExecCGI
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName cvw.local
> DocumentRoot "d:/webdev"
> <Directory "d:/webdev">
> Options Indexes FollowSymLinks Includes ExecCGI
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName sfgh.local
> DocumentRoot "d:/SFGHWeb"
> <Directory "d:/SFGHWeb">
> Options Indexes FollowSymLinks Includes ExecCGI
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName www.xxx.dynalias.com
> DocumentRoot "c:/web"
> <Directory "c:/web">
> Options Indexes FollowSymLinks Includes ExecCGI
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
> ========================
> My hosts file:
>
> 127.0.0.1 www.xxx.dynalias.com
> 127.0.0.1 xampp.local
> 127.0.0.1 cvw.local
> 127.0.0.1 sfgh.local
> 127.0.0.1 localhost
>
> Thanks,
> Kurt Miller
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>   


-- 
Alain Wolf

Email: wolf@restkultur.ch

Work:   +41 (43) 243 9344
Mobile: +41 (78) 897 8776

Kochstrasse 18
CH - 8004 Zurich
Switzerland


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual hosting - 2.2.2 - XP

Posted by Eike Frost <ei...@kefro.st>.
Hello,

On Saturday 05 August 2006 19:31, kurt miller wrote:
> Thusfar, I am able to successfully map to the local
> development sites using virtual hosting and my hosts file. The problem I
> am struggling  with is how to map the www.xxx.dynalias.com to more
> than one site. Is this even possible? As in www.xxx.dynalias.com/site1  or 
> www.xxx.dynalias.com/site2 etc. 

That depends, really. You can't delegate subdirectories within a domain to 
different vhosts via ServerName or ServerAlias; It's simply not made for 
that. What you could do is use yyy.xxx.dynalias.com for client yyy, 
zzz.xxx.dynalias.com for client zzz, etc however, if your dynamic DNS 
provider assigns a wildcard to your host.
If you absolutely want http://www.xxx.dynalias.com/yyy/ to work, you can 
achieve that in various ways; one of them would be to define an Alias or 
ScriptAlias for /yyy to the directory you run site yyy out of. If you do not 
use further configuration in the vhost context for the local yyy, that would 
work. If you do, however, configure different local vhosts differently (or 
want logging in separate files), you could use mod_proxy to forward requests 
sent to /yyy/ to yyy.local transparently using mod_rewrite :

RewriteRule ^/yyy/(.*)$ http://yyy.local/$1 [P]

inside the public-facing vhost would transparently proxy requests to /yyy/* to 
your local vhost (assuming apache on that machine can locally resolve the 
local hostname). You may have to twiddle with your code a bit so that it can 
handle being invoked via an URL that it does not know about, though, and logs 
will include 127.0.0.1/localhost as the remote ip/host. It's also not the 
most efficient solution, but from your comments I assume this is not a 
production environment, anyway.

--Eike