You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stephen Reppucci <sg...@logsoft.com> on 2001/11/30 15:42:52 UTC

Re: Vhosts + mod_perl

Well, you certainly haven't inconvenience yourself by taking the
time to look at the copious documentation available on this, now
have you?

That said, here's a snippet of what you want to use:

NameVirtualHost 192.168.0.10
<VirtualHost 192.168.0.10>

  ServerName   www.logsoft.com
  ServerAlias      logsoft.com
  ServerAlias www2.logsoft.com

  DocumentRoot  /var/apache/htdocs

  Options      +ExecCGI +Indexes
  AddHandler   cgi-script .cgi


  <Location /perl>
    SetHandler perl-script
    PerlFreshRestart On
    PerlHandler Foo:Bar
    PerlSetVar SOME_VAR /usr/local/foo
  </Location>

</VirtualHost>

hth,
<Steve>

On Sat, 1 Dec 2001, James wrote:

> Does anyone have a quick example of setting up a vhost with mod_perl
> enabled please? Also an ordinary cgi-bin, with file extensions .pl and
> .cgi enabled?
>
> Also with a vhost, I can name the host anything I like can't I? For
> example, say my domain is localhost.localdomain but I'm using dyndns to
> make it a hostname, say, trains.ath.cx. I can assign fred.trains.ath.cx
> and john.trains.ath.cx with vhosts, the requests will get piped to my
> main machine which is trains, and the vhost section will take care of
> the rest, knowing which document root to use, right? I don't have to
> mess around with DNS or anything do I to make new subdomains?
>
> Is it:
>
> <virtualhost fred.trains.ath.cx /doc/root>
> Options +Indexes +ExecCGI
> DocumentIndex ??? index.html default.html
> perl-handler     # hmm, get mod_perl working in /doc/root/perl
> cgi-bin
> 	# hmmm, get a cgi-bin happening in /doc/root/cgi-bin
> </virtualhost>
>
> Or something like that?
>
> Many Thanks.
> James
>

-- 
Steve Reppucci                                       sgr@logsoft.com |
Logical Choice Software                          http://logsoft.com/ |
=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=


Re: Vhosts + mod_perl

Posted by Jorge Godoy <go...@conectiva.com>.
James <gn...@ozemail.com.au> writes:

> Now, how did I know I was going to get flamed?? :/
>
> Anyway thanks for the example. Some manuals are too hard to read, you
> have to be a goddamn PhD to read some of them out there to untangle
> the mess of cross references and incomplete examples. :/
>
> But, with that e.g. that uses an IP address, from day to day I don't
> know what my IP address will be, can't I use:
>
> NameVirtualHost fred.trains.ath.cx
> <VirtualHost fred>
> ... foo
> </VirtualHost>

I'm successfully using with my ADSL connection:



NameVirtualHost 0.0.0.0

<VirtualHost 0.0.0.0>
   ServerName vhost.something.here
   ...
</VirtualHost>


See you,
-- 
Godoy. <go...@conectiva.com>

Solutions Developer       - Conectiva Inc. - http://en.conectiva.com
Desenvolvedor de Soluções - Conectiva S.A. - http://www.conectiva.com.br

[OT] Re: Vhosts + mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
> Now, how did I know I was going to get flamed?? :/
>
> Anyway thanks for the example. Some manuals are too hard to read, you
> have to be a goddamn PhD to read some of them out there to untangle the
> mess of cross references and incomplete examples. :/

Some are, but this one isn't.  This is also off-topic since these aren't
mod_perl questions.

> But, with that e.g. that uses an IP address, from day to day I don't
> know what my IP address will be, can't I use:
>
> NameVirtualHost fred.trains.ath.cx
> <VirtualHost fred>
> ... foo
> </VirtualHost>

http://httpd.apache.org/docs/vhosts/name-based.html

There are also tutorials on this subject linked from here:
http://httpd.apache.org/docs/misc/tutorials.html

- Perrin


Re: Vhosts + mod_perl

Posted by Maarten Koskamp <mk...@kluwer.nl>.
Take a look here:
http://dsb3.com/dave/dynipvhost.html
or here:
http://orbitstar.linux-site.net/pub/archive/apache-vhosts.html

Greetz.

maarten.


Re: [OT] Re: Vhosts + mod_perl

Posted by Dave Baker <da...@dsb3.com>.
On Sun, Dec 02, 2001 at 04:19:28PM -0000, Jonathan M. Hollin wrote:
> :: Everytime I make a new document root for a different website, say the
> :: subdomain loco on trains.ath.cx, do I need to update the DNS?
> ::
> :: For foo.trains.ath.cx and bar.trains.ath.cx do I need to make new DNS
> :: entries for foo and bar subdomains? Surely I don't? Because browsers
> :: will ask for it, and get directed to trains.ath.cx, and my apache will
> :: take are of the rest from the HTTP 1.1 Host: field?
> 
> If you are adding sub-domains then, of course, you need to update your DNS.
> Without a corresponding DNS entry, how could "foo.trains.ath.cx" ever be
> resolved?
>

Actually, it's possible to create a wildcard domain so that
*.trains.ath.cx will resolve identically.  

If you choose to do this you no longer have to update DNS for new hosts
but run the risk of people getting inappropriate errors when using a
hostname that shouldn't exist.  Instead of getting 'no such host' they'll
end up with a valid IP and will hit your web server which then has to
decide how to handle it.

As an example, your zone file can look just as follows - I've split www
and vhosts onto separate IP addresses but this isn't required, as you can
mix named and wildcard entries fairly freely.  If you use tools such as
dnslint you may need to append a comment on the end of your wildcard line
to indicate to dnslint that the wildcard is intentional.

(header fluff)

;; 'real' host
www   IN  A   123.123.123.1
vhost IN  A   123.123.123.2

ftp   CNAME   www.trains.ath.cx.

;; everything else.
*     CNAME   vhost.trains.ath.cx.

(footer fluff)


Dave

-- 

- Dave Baker  :  dave@dsb3.com  :  dave@devbrain.com  :  http://dsb3.com/ -
GnuPG:  1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D


RE: [OT] Re: Vhosts + mod_perl

Posted by "Jonathan M. Hollin" <ne...@digital-word.com>.
:: Everytime I make a new document root for a different website, say the
:: subdomain loco on trains.ath.cx, do I need to update the DNS?
::
:: For foo.trains.ath.cx and bar.trains.ath.cx do I need to make new DNS
:: entries for foo and bar subdomains? Surely I don't? Because browsers
:: will ask for it, and get directed to trains.ath.cx, and my apache will
:: take are of the rest from the HTTP 1.1 Host: field?

If you are adding sub-domains then, of course, you need to update your DNS.
Without a corresponding DNS entry, how could "foo.trains.ath.cx" ever be
resolved?

Jonathan M. Hollin - WYPUG Co-ordinator
West Yorkshire Perl User Group
http://wypug.pm.org/


[OT] Re: Vhosts + mod_perl

Posted by James <gn...@ozemail.com.au>.
Hi Marius,

Everytime I make a new document root for a different website, say the 
subdomain loco on trains.ath.cx, do I need to update the DNS?

For foo.trains.ath.cx and bar.trains.ath.cx do I need to make new DNS 
entries for foo and bar subdomains? Surely I don't? Because browsers 
will ask for it, and get directed to trains.ath.cx, and my apache will 
take are of the rest from the HTTP 1.1 Host: field?

Thanks :)

Cheers,
James


> On Dec 1 at 01:59, 'James' wrote:
> |J|But, with that e.g. that uses an IP address, from day to day I don't 
> |J|know what my IP address will be, can't I use:
> |J|NameVirtualHost fred.trains.ath.cx
> |J|<VirtualHost fred>
> |J|... foo
> |J|</VirtualHost>
> 
> NameVirtualHost *
> <VirtualHost *>
>     ServerName  www.foo.com
>     ...
> </VirtualHost>
> 
> specifying '*' as the argument of NameVirtualHost it's a new feature as of 
> Apache version 1.3.13. It's quite tricky to use it in complex configuration 
> (multiple listening ports/ip addresses) but it is really very powerful :)
> 
> cheers.
> - -- 
> Marius Feraru                                 http://altblue.n0i.net/




Re: Vhosts + mod_perl

Posted by Marius Feraru <al...@deathsdoor.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Dec 1 at 01:59, 'James' wrote:
|J|But, with that e.g. that uses an IP address, from day to day I don't 
|J|know what my IP address will be, can't I use:
|J|NameVirtualHost fred.trains.ath.cx
|J|<VirtualHost fred>
|J|... foo
|J|</VirtualHost>

NameVirtualHost *
<VirtualHost *>
    ServerName  www.foo.com
    ...
</VirtualHost>

specifying '*' as the argument of NameVirtualHost it's a new feature as of 
Apache version 1.3.13. It's quite tricky to use it in complex configuration 
(multiple listening ports/ip addresses) but it is really very powerful :)

cheers.
- -- 
Marius Feraru                                 http://altblue.n0i.net/
"it's easy to stop using Perl: I do it after every project."
-----BEGIN PGP SIGNATURE-----

iD8DBQE8CiPBn0ZKufYp8iURAjw9AJ9MtY3gOtwELcnidr83aQ942a9iDACaA8l9
nwmEW30EE5NMHOfJhvPbe9A=
=7rPg
-----END PGP SIGNATURE-----


Re: Vhosts + mod_perl

Posted by James <gn...@ozemail.com.au>.
Now, how did I know I was going to get flamed?? :/

Anyway thanks for the example. Some manuals are too hard to read, you 
have to be a goddamn PhD to read some of them out there to untangle the 
mess of cross references and incomplete examples. :/

But, with that e.g. that uses an IP address, from day to day I don't 
know what my IP address will be, can't I use:

NameVirtualHost fred.trains.ath.cx
<VirtualHost fred>
... foo
</VirtualHost>

?

Thanks and all.
James


Stephen Reppucci wrote:

> Well, you certainly haven't inconvenience yourself by taking the
> time to look at the copious documentation available on this, now
> have you?
> 
> That said, here's a snippet of what you want to use:
> 
> NameVirtualHost 192.168.0.10
> <VirtualHost 192.168.0.10>
> 
>   ServerName   www.logsoft.com
>   ServerAlias      logsoft.com
>   ServerAlias www2.logsoft.com
> 
>   DocumentRoot  /var/apache/htdocs
> 
>   Options      +ExecCGI +Indexes
>   AddHandler   cgi-script .cgi
> 
> 
>   <Location /perl>
>     SetHandler perl-script
>     PerlFreshRestart On
>     PerlHandler Foo:Bar
>     PerlSetVar SOME_VAR /usr/local/foo
>   </Location>
> 
> </VirtualHost>
> 
> hth,
> <Steve>
> 
> On Sat, 1 Dec 2001, James wrote:
> 
> 
>> Does anyone have a quick example of setting up a vhost with mod_perl
>> enabled please? Also an ordinary cgi-bin, with file extensions .pl and
>> .cgi enabled?
>> 
>> Also with a vhost, I can name the host anything I like can't I? For
>> example, say my domain is localhost.localdomain but I'm using dyndns to
>> make it a hostname, say, trains.ath.cx. I can assign fred.trains.ath.cx
>> and john.trains.ath.cx with vhosts, the requests will get piped to my
>> main machine which is trains, and the vhost section will take care of
>> the rest, knowing which document root to use, right? I don't have to
>> mess around with DNS or anything do I to make new subdomains?
>> 
>> Is it:
>> 
>> <virtualhost fred.trains.ath.cx /doc/root>
>> Options +Indexes +ExecCGI
>> DocumentIndex ??? index.html default.html
>> perl-handler     # hmm, get mod_perl working in /doc/root/perl
>> cgi-bin
>> 	# hmmm, get a cgi-bin happening in /doc/root/cgi-bin
>> </virtualhost>
>> 
>> Or something like that?
>> 
>> Many Thanks.
>> James
>>