Re: Virtual Host Logging Perl Script

2003-07-16 Thread Ged Haywood
Hi there,

On Tue, 15 Jul 2003, Jez Hancock wrote:

 Does anyone how one could log errorlog entries in a similar manner to
 the script above - ie pipe the errorlog to a script which appends one
 copy of the error entry to a main error logfile and another copy to the
 virtual host's error logfile?

It's possible, but I don't think you really want to do it.  You would
be asking the server to do more than is necessary while handling each
request (you probably already are:).

Would it not be better for example to rotate your logs frequently, and
to process them afterwards, off-line?  You would then have a choice of
doing things with the various log file analysis tools too.  If you are
a little bit creative in what you log, it can be simple to extract the
information you need for each vhost from one file.

Have you considered using something other than flat files for logging?

73,
Ged.




Re: Virtual Host Logging Perl Script

2003-07-16 Thread Jez Hancock
On Wed, Jul 16, 2003 at 12:40:06PM +0200, Guillaume Fougnies wrote:
 Wed, Jul 16, 2003 at 11:07:47AM +0100: Jez Hancock wrote:
  I would do this but we wanted to give our users 'live' logfiles, rather
  than making them wait until log rotation before being able to view them
  (or did I misunderstand you?).
 
 During my work on the ENodes project, i've developed a tiny threaded logger
 in c to manage internal logfiles (by webmaster/website/version).
 (you can rewrite it in perl with a 5.8.x built with thread...)
 
 Perl handlers send log lines through a UNIX socket to the logger which
 is opening logfiles when needed and keeping them opened.
 It avoids the overhead of opening and locking each time the file and
 provides as many online debug logfile as you ask.
/me nods.  This would save a lot of overhead.  The only benefit of
opening a new pipe each time I suppose is that you don't need to worry
about rotation.

 The logger is launched in a 'PerlRequire' file.
 The client have a persistant connection to the logger.
 
 If it fits your needs, you can get sources here: http://www.enodes.org
  Server   : utils/enodes_logger/enodes_logger.c
  Client module: enodes_core/modules/ENodes/Core/ApLog.pm
Many thanks, I'll investigate now.

Well ENodes sounds very interesting, particularly the part about
webmasters being able to test new versioning without applying changes
and the reduced httpd restart feature.  Very interesting.

Will certainly have a look at this, we're currently considering
something called webcp, a PHP project which has much potential but is
sitll unfortunately very much in beta.

Thanks!
-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-16 Thread Ged Haywood
Hi Jez,

On Wed, 16 Jul 2003, Jez Hancock wrote:

 [snip] We started looking at mod_log_sql: [snip]
 but had trouble getting it to work on FreeBSD unfortunately.

I'd have thought something a bit lighter might do for this.

 Right now it seems a bit silly having a separate ErrorLog line in each
 of the apache virtual host stubs, but as far as I am aware there isn't
 an easier way is there?

You could look at mod_macro.

73,
Ged.




RE: Virtual Host Logging Perl Script (mod_macro note)

2003-07-16 Thread Marc M. Adkins
  Right now it seems a bit silly having a separate ErrorLog line in each
  of the apache virtual host stubs, but as far as I am aware there isn't
  an easier way is there?

 You could look at mod_macro.

mod_macro (http://www.coelho.net/mod_macro) works great for me.  I found
that I had to make a few changes to get it to build for Apache 2.0.46.  To
wit:

110c110
 module macro_module;
---
 module AP_MODULE_DECLARE_DATA   macro_module;
810c810,811
 char * name, * where, * recursion;
---
 char * name, * recursion;
 char * where = ???;
951c952
 AP_DECLARE_DATA module macro_module = {
---
 module AP_MODULE_DECLARE_DATA macro_module = {

The preload of 'where' may be redundant, I don't remember.  I believe that
the use of AP_MODULE_DECLARE_DATA was change that I had to make or nothing
would build.  YMMV

mma



Re: Virtual Host Logging Perl Script (mod_macro note)

2003-07-16 Thread Jez Hancock
On Wed, Jul 16, 2003 at 12:40:10PM -0700, Marc M. Adkins wrote:
   Right now it seems a bit silly having a separate ErrorLog line in each
   of the apache virtual host stubs, but as far as I am aware there isn't
   an easier way is there?
 
  You could look at mod_macro.
 mod_macro (http://www.coelho.net/mod_macro) works great for me.  I found
 that I had to make a few changes to get it to build for Apache 2.0.46.  To
My main motivation for running apache2 would be to make use of
the PerChild MPM which from what I can glean is still not working :(
This directive would save me a lot of hassles wrt running cgi scripts
(php in particular) with the euid of the script owner.  All this as I'm
tussling with mod_suphp...
-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Stas Bekman
Jez Hancock wrote:
Hi,

I've just written a short perl script to perform logging for our virtual
hosts.  The code has plenty of comments so I'll paste it below.
My question is: would it be possible to use mod_perl in some way to
perform the function of the script?  In testing the speed of the script
seems reasonable enough, is there a better way to do what I'm doing
below?
Take a look at:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
a similar code will work for mp1 if you don't use 2.0.
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Jez Hancock
On Tue, Jul 15, 2003 at 01:32:11PM +0300, Stas Bekman wrote:
 Jez Hancock wrote:
 My question is: would it be possible to use mod_perl in some way to
 perform the function of the script?  In testing the speed of the script
 seems reasonable enough, is there a better way to do what I'm doing
 below?
 
 Take a look at:
 http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
 a similar code will work for mp1 if you don't use 2.0.
Much obliged, that does look to be something I could use.  Reminds me I
need to be locking the logfile as well ;)

Thanks Stas,
-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Perrin Harkins
On Tue, 2003-07-15 at 14:27, Jez Hancock wrote:
 On Tue, Jul 15, 2003 at 01:32:11PM +0300, Stas Bekman wrote:
  Take a look at:
  http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
  a similar code will work for mp1 if you don't use 2.0.
 Much obliged, that does look to be something I could use.  Reminds me I
 need to be locking the logfile as well ;)

Actually, if you are just printing one short line I think you'll be fine
without locking on unix systems.  See the FAQ:
http://www.perldoc.com/perl5.8.0/pod/perlfaq5.html#All-I-want-to-do-is-append-a-small-amount-of-text-to-the-end-of-a-file.--Do-I-still-have-to-use-locking-

- Perrin


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Stas Bekman
Perrin Harkins wrote:
On Tue, 2003-07-15 at 14:27, Jez Hancock wrote:

On Tue, Jul 15, 2003 at 01:32:11PM +0300, Stas Bekman wrote:

Take a look at:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
a similar code will work for mp1 if you don't use 2.0.
Much obliged, that does look to be something I could use.  Reminds me I
need to be locking the logfile as well ;)


Actually, if you are just printing one short line I think you'll be fine
without locking on unix systems.  See the FAQ:
http://www.perldoc.com/perl5.8.0/pod/perlfaq5.html#All-I-want-to-do-is-append-a-small-amount-of-text-to-the-end-of-a-file.--Do-I-still-have-to-use-locking-
Is this still correct in the threaded environment where the filehandle is 
shared across several threads? The writes are atomic 4k or so, indeed, but 
what happens if two threads write to the same filehandle at the same time on 
the SMP machine? Won't things get messed up? I haven't checked, perhaps perlio 
already provides an internal locking. Arthur would be a good person to ask.



__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Perrin Harkins
On Tue, 2003-07-15 at 16:11, Stas Bekman wrote:
 Is this still correct in the threaded environment where the filehandle is 
 shared across several threads?

Why would the filehandle be shared?  Wouldn't you open a new handle in
each thread?

I expect this would be fine, since the behavior is enforced by the
system library rather than by Perl.  You can always use flock if you're
feeling paranoid about it though.

- Perrin


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Jez Hancock
On Tue, Jul 15, 2003 at 02:39:18PM -0400, Perrin Harkins wrote:
 On Tue, 2003-07-15 at 14:27, Jez Hancock wrote:
  Much obliged, that does look to be something I could use.  Reminds me I
  need to be locking the logfile as well ;)
 
 Actually, if you are just printing one short line I think you'll be fine
 without locking on unix systems.  See the FAQ:
 http://www.perldoc.com/perl5.8.0/pod/perlfaq5.html#All-I-want-to-do-is-append-a-small-amount-of-text-to-the-end-of-a-file.--Do-I-still-have-to-use-locking-
Ok thanks Perrin.  The script is actually running nicely as it is right
now on a server hosting 50 or so domains, although admittedly it's not
taking a massive number of hits (10,000 or so per day).

Does anyone how one could log errorlog entries in a similar manner to
the script above - ie pipe the errorlog to a script which appends one
copy of the error entry to a main error logfile and another copy to the
virtual host's error logfile?

-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-15 Thread Stas Bekman
Perrin Harkins wrote:
On Tue, 2003-07-15 at 16:11, Stas Bekman wrote:

Is this still correct in the threaded environment where the filehandle is 
shared across several threads?


Why would the filehandle be shared?  Wouldn't you open a new handle in
each thread?
Because it's shared on the OS level. You open a new perl IO handle in each 
thread, but I think that they all use the same filedescriptor underneath. I 
think Arthur was mentioning that at his ithreads talk. Need to run some tests 
to confirm that.

I expect this would be fine, since the behavior is enforced by the
system library rather than by Perl.  You can always use flock if you're
feeling paranoid about it though.
Are you sure? Won't flock maintain a process-wide flag? Unless there is a 
special threads-aware implementation that does it right.

This is of course just rambling based on known issuws with all the other 
process-wide variables like cwd, chroot, environ, etc.



__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Virtual Host Logging Perl Script

2003-07-14 Thread Jez Hancock
Hi,

I've just written a short perl script to perform logging for our virtual
hosts.  The code has plenty of comments so I'll paste it below.

My question is: would it be possible to use mod_perl in some way to
perform the function of the script?  In testing the speed of the script
seems reasonable enough, is there a better way to do what I'm doing
below?

On a related note, I'd ideally like to be able to do similar for Apache
Error logging - ie log apache error log entries once into a main
errorlog file and once into a vhost errorlog file.  Is this possible
with ErrorLog lines?
My initial understanding is this isn't possible using the framework 
outlined in the code below.

Code follows:

#!/usr/bin/perl
# Script to pipe apache log entries to virtually hosted log files

# Assumes httpd.conf has the following:

# LogFormat %v %h %l %u %t \%r\ %s %b commonvhost

# and that ONLY the following logging line is used in the httpd.conf:
# CustomLog | /path/to/logger.pl commonvhost

# DO NOT configure the CustomLog directive in the vhost stubs for vhosts
# or this will not work.

# Script logs commonvhost entries to a logfile with a template of:
# /var/log/httpd/virtual.domain/$year/$month/$day

use strict;

my $logEntry = ;

# get the vhost from this log entry:
$logEntry=~/(.*?) /;
my $vhost = $1;

my ($year, $month, $day) = (
(localtime)[5]+1900,
sprintf(%02d, (localtime)[4]+1),
sprintf(%02d, (localtime)[3])
);

# Name of access logfiles:
my $accessLogName = httpd-access.log;


=comment
$logdir:
Location to put all logfiles

This will log everything into:
$logdir/all/$year/$month/$day/httpd-access.log

and put individual vhost logfiles into:
$logdir/$vhost/$year/$month/$day/httpd-access.log
=cut

my $logDir = /var/log/httpd;
my $allLogDir = $logDir/all/$year/$month/$day;
my $vhostLogDir = $logDir/$vhost/$year/$month/$day;

writeLog($allLogDir, all);
writeLog($vhostLogDir, vhost);

# write a log entry to a file
sub writeLog(){
my $logDir = shift @_;
my $type = shift @_;

if( ! -d $logDir ) {
`mkdir -p $logDir`;
}

open(FD, $logDir/$accessLogName);

# if type is vhost, strip off the vhost data:
if($type eq vhost){
$logEntry =~s/.*? //;
}
print FD $logEntry;
close FD;
}

-- 
Jez

http://www.munk.nu/


Virtual Host Logging Perl Script

2003-07-14 Thread Jez Hancock
Hi,

I've just written a short perl script to perform logging for our virtual
hosts.  The code has plenty of comments so I'll paste it below.

My question is: would it be possible to use mod_perl in some way to
perform the function of the script?  In testing the speed of the script
seems reasonable enough, is there a better way to do what I'm doing
below?

On a related note, I'd ideally like to be able to do similar for Apache
Error logging - ie log apache error log entries once into a main
errorlog file and once into a vhost errorlog file.  Is this possible
with ErrorLog lines?
My initial understanding is this isn't possible using the framework 
outlined in the code below.

Code follows:

#!/usr/bin/perl
# Script to pipe apache log entries to virtually hosted log files

# Assumes httpd.conf has the following:

# LogFormat %v %h %l %u %t \%r\ %s %b commonvhost

# and that ONLY the following logging line is used in the httpd.conf:
# CustomLog | /path/to/logger.pl commonvhost

# DO NOT configure the CustomLog directive in the vhost stubs for vhosts
# or this will not work.

# Script logs commonvhost entries to a logfile with a template of:
# /var/log/httpd/virtual.domain/$year/$month/$day

use strict;

my $logEntry = ;

# get the vhost from this log entry:
$logEntry=~/(.*?) /;
my $vhost = $1;

my ($year, $month, $day) = (
(localtime)[5]+1900,
sprintf(%02d, (localtime)[4]+1),
sprintf(%02d, (localtime)[3])
);

# Name of access logfiles:
my $accessLogName = httpd-access.log;


=comment
$logdir:
Location to put all logfiles

This will log everything into:
$logdir/all/$year/$month/$day/httpd-access.log

and put individual vhost logfiles into:
$logdir/$vhost/$year/$month/$day/httpd-access.log
=cut

my $logDir = /var/log/httpd;
my $allLogDir = $logDir/all/$year/$month/$day;
my $vhostLogDir = $logDir/$vhost/$year/$month/$day;

writeLog($allLogDir, all);
writeLog($vhostLogDir, vhost);

# write a log entry to a file
sub writeLog(){
my $logDir = shift @_;
my $type = shift @_;

if( ! -d $logDir ) {
`mkdir -p $logDir`;
}

open(FD, $logDir/$accessLogName);

# if type is vhost, strip off the vhost data:
if($type eq vhost){
$logEntry =~s/.*? //;
}
print FD $logEntry;
close FD;
}

-- 
Jez

http://www.munk.nu/


sending ssl certificate according to virtual host

2002-11-06 Thread Mathieu Jondet
hi all,
i'm actually working on a system where a user can create domains /
subdomains throug a webinterface and doesn't have to interact with the
httpd.conf.
For this I use a unique virtualhost which intercept all client request
no matter which vh is requested. After a handler treat the request and
fetch the
data where it should be fetch.
Everyhing is working fine, but I would like to add SSL support on
the system. I want to be able to send the SSL certificate and key files
for the requested virtual host.
Depending on the vh requested I set the SSLCertificateFile and
SSLCertificateKeyFile which will point to the correct ssl files for the
requested vh.

Is there a way for doing this ?
All input appreciated and I hope my explanatins are clear enough on what
i want to do.

Thanks,
Mathieu




Re: sending ssl certificate according to virtual host

2002-11-06 Thread Mads Toftum
On Wed, Nov 06, 2002 at 11:52:13AM -0500, Vivek Khera wrote:
 What they should have done is what is done now with TLS in SMTP.  You
 connect to the same port, but issue a STARTTLS command to switch
 over to secured mode.  With this type of scheme, the header info with
 the desired host could be in the initial request, so then you could
 pick the right certificates to use.  Alas, the HTTP protocol doesn't
 work this way as far as I can tell.
 
An untested patch to support this in Apache 2 was sent to the devhttpd
list by Ryan Bloom a few weeks back. Getting support for STARTTLS into
Apache is only the first step - so far no clients support it yet.

vh

Mads Toftum
-- 
`Darn it, who spiked my coffee with water?!' - lwall




Re: sending ssl certificate according to virtual host

2002-11-06 Thread James G Smith
Mathieu Jondet [EMAIL PROTECTED] wrote:
hi all,
i'm actually working on a system where a user can create domains /
subdomains throug a webinterface and doesn't have to interact with the
httpd.conf.
For this I use a unique virtualhost which intercept all client request
no matter which vh is requested. After a handler treat the request and
fetch the
data where it should be fetch.
Everyhing is working fine, but I would like to add SSL support on
the system. I want to be able to send the SSL certificate and key files
for the requested virtual host.
Depending on the vh requested I set the SSLCertificateFile and
SSLCertificateKeyFile which will point to the correct ssl files for the
requested vh.

Is there a way for doing this ?
All input appreciated and I hope my explanatins are clear enough on what
i want to do.

HTTP rides on top of SSL/TLS.  The SSL connection is established and
certificates exchanged before any HTTP request is sent.  The SSL
certificate must be configured on a per-IP-address basis.  You might
want to look into a certificate for a wildcarded domain (e.g.,
*.mydomain.com) and have that handle all the subdomains.  I think
that's possible, but I'm not positive.  We use fully qualified domain
names ourselves.
-- 
James Smith [EMAIL PROTECTED], 979-862-3725
Texas AM CIS Operating Systems Group, Unix



[OT] Re: sending ssl certificate according to virtual host

2002-11-06 Thread Issac Goldstand

- Original Message -
From: Vivek Khera [EMAIL PROTECTED]
Newsgroups: ml.apache.modperl
To: [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 6:52 PM
Subject: Re: sending ssl certificate according to virtual host


  MJ == Mathieu Jondet [EMAIL PROTECTED] writes:

 MJ Depending on the vh requested I set the SSLCertificateFile and
 MJ SSLCertificateKeyFile which will point to the correct ssl files for
the
 MJ requested vh.

 What they should have done is what is done now with TLS in SMTP.  You
 connect to the same port, but issue a STARTTLS command to switch
 over to secured mode.  With this type of scheme, the header info with
 the desired host could be in the initial request, so then you could
 pick the right certificates to use.  Alas, the HTTP protocol doesn't
 work this way as far as I can tell.


I dunno...  What if you want to send a cookie in secured mode?  That's part
of the headers, and of equal priority as the Hostname: header used to
determine the correct VirtualHost to use...  I'm sure that SSL could be fit
much nicer over HTTP/1.1, but it would probably rip apart alot of the solid
standards involved - such as creating priorities inside the headers, or the
option to take multiple commands...

Origianlly, when writing this email, I was going to suggest a CONNECT /
STARTTLS scheme which would work in Keep-Alive mode until the server clsoed
the connection...  But then I found an existing RFC which describes it - so
the question (probably a stupid one which I don't realize is stupid only
because I just now stumbled accross the RFC and still don'ty properly
understand what's involved) is: why is it not implemented?

Anyway, the RFC in question is 2817 (http://www.ietf.org/rfc//rfc2817.txt)

  Issac




Re: sending ssl certificate according to virtual host

2002-11-06 Thread Vivek Khera
 MJ == Mathieu Jondet [EMAIL PROTECTED] writes:

MJ Depending on the vh requested I set the SSLCertificateFile and
MJ SSLCertificateKeyFile which will point to the correct ssl files for the
MJ requested vh.

You can't do this with name-based vhosts.  To present the proper SSL
certificate, you have to do it at the connection time (before any
data, including the desired host name is sent to you), and you can
only do that with unique IP addresses or unique port numbers per
vhost.

Yes, this sucks.  The people who invented SSL were not very forward
thinking.

What they should have done is what is done now with TLS in SMTP.  You
connect to the same port, but issue a STARTTLS command to switch
over to secured mode.  With this type of scheme, the header info with
the desired host could be in the initial request, so then you could
pick the right certificates to use.  Alas, the HTTP protocol doesn't
work this way as far as I can tell.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/



Re: Apache and Perl with Virtual Host [OT]

2002-03-23 Thread Ged Haywood

Hi again,

Oh, rats, I'm sorry, I shouldn't have sent that.  I'm not sure that
it's your 'Options' settings at all.  Have you got the right execute
permisions on the directories/files that you're trying to get Apache
to search and/or execute?  Have you got anything in the error_log?

By way of further apology, if you'd care to reply to me privately
we'll get it running for you off-list as it's not a mod_perl issue.

73,
Ged.

--

On Sat, 23 Mar 2002, Ged Haywood wrote:

 Hi there,
 
 On Fri, 22 Mar 2002, Matt Phelps wrote:
 
 [snip,snip]
  Okay, this is still giving me problems. Here is my config. I've
  tried several things and still nothing. For some reason I can't get
  cgi scripts to run under any virtual webs, but the default web.
 
 What's a 'web'?  I think you mean 'host'.  (It helps if we all speak
 the same language, especially if we are using a search engine... :)
 
  I do have mod_perl installed.
 
 Oh, all right then... :)
 
  I'm sure it's got to be something so simple.
 
 I think it's called 'reading the documentation'... :)
 
  VirtualHost 192.168.1.106
  DocumentRoot /var/www/html
  ServerName www2.zeetec.net
  Options +ExecCGI
  Alias /host/ /webhome/host/
  Alias /cgi-bin/ /var/www/cgi-bin/
  ScriptAlias /cgi-bin/ /var/www/cgi-bin
  Location /perl
  SetHandler perl-script
  PerlHandler Apache::Registry
  PerlSendHeader On   
  Options +ExecCGI
  /Location
  Directory /var/www/cgi-bin
  AllowOverride None
  Options None   --- This removes 'ExecCGI' from your Options
  Order allow,deny
  Allow from all
  /Directory
  /VirtualHost
 
 Check the Apache docs about the behaviour of the 'Options' directive.
 
 73,
 Ged.
 
 




Re: Apache and Perl with Virtual Host

2002-03-22 Thread Matt Phelps

Okay, this is still giving me problems. Here is my config. I've tried 
several things and still nothing. For some reason I can't get cgi 
scripts to run under any virtual webs, but the default web. I'm running 
RH 7.2 with apache 1.3.20. I do have mod_perl installed.  My other box 
with RH 6.0 with apache 1.3.14, the cgi-bins work fine under all the 
virtual webs. I've compared the two config files, but I haven't seen 
what would cause it. I'm sure it's got to be something so simple.




VirtualHost 192.168.1.106
DocumentRoot /var/www/html
ServerName www2.zeetec.net
Options +ExecCGI
Alias /host/ /webhome/host/
Alias /cgi-bin/ /var/www/cgi-bin/
ScriptAlias /cgi-bin/ /var/www/cgi-bin
Location /perl
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On   
Options +ExecCGI
/Location
Directory /var/www/cgi-bin
AllowOverride None
Options None
Order allow,deny
Allow from all
/Directory
/VirtualHost


Bill Marrs wrote:

 At 04:02 AM 3/14/2002, Matt Phelps wrote:

 Forgive me if I'm posting to the wrong group. Ive got apache 1.3.22 
 running several virtual webs. I can get perl scripts to run under the 
 default web but not in the others. All the webs point to the same 
 script folder. If I try to run the script under a virtual web, all I 
 get is text display. Any help would be great.


 Well, I use mod_perl with VituralHosts...  My config looks something 
 like:

 VirtualHost gametz.com
 ServerAdmin [EMAIL PROTECTED]
 DocumentRoot /home/tz/html
 ServerName gametz.com
 DirectoryIndex /perl/gametz.pl
 # The live area
 Alias /perl/ /home/tz/perl/
 Location /perl
   AllowOverride  None
   SetHandler perl-script
   PerlHandler Apache::RegistryBB
   PerlSendHeader On
   Options+ExecCGI
 /Location
 /VirtualHost

 VirtualHost surveycentral.org
 ServerAdmin [EMAIL PROTECTED]
 DocumentRoot /projects/web/survey-central
 ServerName surveycentral.org
 DirectoryIndex /perl/survey.pl

 Alias /perl/ /projects/web/survey-central/perl/
 Location /perl
   SetHandler perl-script
   PerlHandlerApache::RegistryBB
   PerlSendHeader On
   Options+ExecCGI
 /Location
 /VirtualHost








Re: Apache and Perl with Virtual Host

2002-03-22 Thread Ged Haywood

Hi there,

On Fri, 22 Mar 2002, Matt Phelps wrote:

[snip,snip]
 Okay, this is still giving me problems. Here is my config. I've
 tried several things and still nothing. For some reason I can't get
 cgi scripts to run under any virtual webs, but the default web.

What's a 'web'?  I think you mean 'host'.  (It helps if we all speak
the same language, especially if we are using a search engine... :)

 I do have mod_perl installed.

Oh, all right then... :)

 I'm sure it's got to be something so simple.

I think it's called 'reading the documentation'... :)

 VirtualHost 192.168.1.106
 DocumentRoot /var/www/html
 ServerName www2.zeetec.net
 Options +ExecCGI
 Alias /host/ /webhome/host/
 Alias /cgi-bin/ /var/www/cgi-bin/
 ScriptAlias /cgi-bin/ /var/www/cgi-bin
 Location /perl
 SetHandler perl-script
 PerlHandler Apache::Registry
 PerlSendHeader On   
 Options +ExecCGI
 /Location
 Directory /var/www/cgi-bin
 AllowOverride None
 Options None   --- This removes 'ExecCGI' from your Options
 Order allow,deny
 Allow from all
 /Directory
 /VirtualHost

Check the Apache docs about the behaviour of the 'Options' directive.

73,
Ged.




Apache and Perl with Virtual Host

2002-03-14 Thread Matt Phelps

Forgive me if I'm posting to the wrong group. Ive got apache 1.3.22 
running several virtual webs. I can get perl scripts to run under the 
default web but not in the others. All the webs point to the same script 
folder. If I try to run the script under a virtual web, all I get is 
text display. Any help would be great.

Thanks

Matt





Re: Apache and Perl with Virtual Host

2002-03-14 Thread Bill Marrs

At 04:02 AM 3/14/2002, Matt Phelps wrote:
Forgive me if I'm posting to the wrong group. Ive got apache 1.3.22 
running several virtual webs. I can get perl scripts to run under the 
default web but not in the others. All the webs point to the same script 
folder. If I try to run the script under a virtual web, all I get is text 
display. Any help would be great.

Well, I use mod_perl with VituralHosts...  My config looks something like:

VirtualHost gametz.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /home/tz/html
ServerName gametz.com
DirectoryIndex /perl/gametz.pl
# The live area
Alias /perl/ /home/tz/perl/
Location /perl
   AllowOverride  None
   SetHandler perl-script
   PerlHandler Apache::RegistryBB
   PerlSendHeader On
   Options+ExecCGI
/Location
/VirtualHost

VirtualHost surveycentral.org
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /projects/web/survey-central
ServerName surveycentral.org
DirectoryIndex /perl/survey.pl

Alias /perl/ /projects/web/survey-central/perl/
Location /perl
   SetHandler perl-script
   PerlHandlerApache::RegistryBB
   PerlSendHeader On
   Options+ExecCGI
/Location
/VirtualHost





Re: virtual host server root

2002-03-01 Thread Andy Lester

  I'm trying to create a root directory for each of my virtuals.
  the realm of the virtual that certainly shouldn't be within
 [snip]
  I've come up with three solutions, none of which I
  particularly like for various reasons.

 Have you looked at mod_macro?

mod_macro has been a godsend for me.  I was about thisclose to writing
something to generate my http.conf for me.



-- 
%_=split/;/,.;;n;u;e;ot;t;her;c; .   #   Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
hack;print map delete$_{$_},split//,q   [EMAIL PROTECTED]   





Re: virtual host server root

2002-03-01 Thread Rick Myers

On Mar 01, 2002 at 19:30:37 +, Ged Haywood wrote:
 Hi there,
 
 On Wed, 27 Feb 2002, Rick Myers wrote:
 
  I'm trying to create a root directory for each of my virtuals
  the realm of the virtual that certainly shouldn't be within
 [snip]
  I've come up with three solutions, none of which I
  particularly like for various reasons
 
 Have you looked at mod_macro?

I hadn't until now, but it looks interesting Not quite what
I had in mind though

Thanks

--rick




virtual host server root

2002-02-27 Thread Rick Myers

I'm trying to create a root directory for each of my
virtuals. The reason is that there's plenty of stuff within
the realm of the virtual that certainly shouldn't be within
the document root -- templates, cache, logs, etc. Plus, I
might want to point a virtual into a user dir somewhere.

I've come up with three solutions, none of which I
particularly like for various reasons.

- PerlSetVar VRoot /someplace
Simple, but I've always had a distaste for
PerlSetVar for some reason. *shrug*

- VRoot /someplace
Not as simple. Requires yet another module to
implement and adds even more overhead to the server
conf file.

- ServerPath /someplace
Pretty simple Server.xs hack, but probably never
supported. Also might open up security holes.

Is anybody else doing this sort of thing?

--rick




disable mod_perl for specific loation/virtual host

2002-01-21 Thread pilsl

I've a server that has pl-files for mod_perl and cgi for standard-cgi and 
now got a bunch of pl-files that do not run under mod_perl and cannot be 
renamed in cgi, cause they are linked in frames on distant hosts where I 
dont have access too.

So I need to disable mod_perl for these pl-files for this specific virtual 
host:

I activate mod_perl in main-part of my http.conf:
Files ~ \.pl$
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
/Files

for all virtual hosts

and now need to know which PerlHandler is responsible for no-mod_perl cgi.
(The PerlRun-Handler also fails ...)

It tried in the virtual host section:
Files ~ \.pl$
SetHandler cgi-script
Options +ExecCGI
/Files

and even SetHandler default-handler

And I tried 

AddHandler cgi-script .pl

but this wont do it. 


thnx,
peter




Re: Virtual Host?

2001-09-11 Thread Rafiq Ismail

I set up something similar recently.  What I would recommend is setting up
a separate samba view to 'just' that dirctory on your unix disk which you
wish to make publically accessible - set this up in your smb.conf file.  
You can specify valid users (just the webserver?), whether it is writable
accross the network, default netmask etc.

You can then set appropriate write permissions on it, without making your
whole secure and wonderful unix partion vulnerable to access from your not
so wonderful NT server.  If you only need a view to those files which you
want to add to your web server readable directories, there is no need to
make the whole drive visible from the outside.  Just map that view to a
drive, point your httpd.conf at the drive and you're sorted.

R.

On Mon, 10 Sep 2001, Medi Montaseri wrote:

 
 I think people are responding with how to fix this on a Unix. He is on
 a NT.
 
 Assuming the disk is on the Unix and the Unix is running Samba, then
 just define a network drive on your NT, say 
 
 V: which mapps to \\yourunixbox\disk7
 
 

-- 
Rafiq Ismail

Software Engineer and Systems Administrator
http://www.codix.net


All the best people in life seem to like Linux. - Steve Wozniak







Virtual Host?

2001-09-10 Thread Purcell, Scott

Hello,
I have Apache w/modperl running on my NT box.  The box has Samba on it, and
I can see my Unix volumes from my SGI box.

There is a volume there /DISK7 and I would like to be able to use that as a
kind of Virtual host through the Apache Web server. /DISK7 has a bunch of
.mov files that instead of copying to the htdocs directory, I would like to
be able to href link to them and have them displayed.

So my question is, where in the config (or how do I) configure the
httpd.conf to allow me to use /DISK7 as part of the doc root?

Thanks,


Scott Purcell




Re: Virtual Host?

2001-09-10 Thread Medi Montaseri


I think people are responding with how to fix this on a Unix. He is on
a NT.

Assuming the disk is on the Unix and the Unix is running Samba, then
just define a network drive on your NT, say 

V: which mapps to \\yourunixbox\disk7

Then in your http.conf on your NT, define an alias like

Alias /wav/ v:what\ever\folder

And from there, URLs pointing to http://xyz/wav will be looked up
from v:


On Mon, 10 Sep 2001, Purcell, Scott wrote:

 Hello,
 I have Apache w/modperl running on my NT box.  The box has Samba on it, and
 I can see my Unix volumes from my SGI box.
 
 There is a volume there /DISK7 and I would like to be able to use that as a
 kind of Virtual host through the Apache Web server. /DISK7 has a bunch of
 .mov files that instead of copying to the htdocs directory, I would like to
 be able to href link to them and have them displayed.
 
 So my question is, where in the config (or how do I) configure the
 httpd.conf to allow me to use /DISK7 as part of the doc root?
 
 Thanks,
 
 
 Scott Purcell
 
 

-- 
-
Medi Montaseri   [EMAIL PROTECTED]
Unix Distributed Systems EngineerHTTP://www.CyberShell.com
CyberShell Engineering
-




RE: Virtual Host?

2001-09-10 Thread Medi Montaseri

How about a symbolic link...

On Mon, 10 Sep 2001, Rob Bloodgood wrote:

 
  i think you may have to mount it
  mount -t smb -o username=user,password=pass //ntserver//disk7
  /mnt/smbshare
 
  then just add /mnt/smbshare to doc root!
 
 Except that, to the best of my knowledge, Samba can only mount to regular
 mount points on Linux.
 
 Rob
 
 #!/usr/bin/perl -w
 use Disclaimer qw/:standard/;
 
 
 

-- 
-
Medi Montaseri   [EMAIL PROTECTED]
Unix Distributed Systems EngineerHTTP://www.CyberShell.com
CyberShell Engineering
-




Re: Virtual Host?

2001-09-10 Thread clayton cottingham

Purcell, Scott wrote:
 
 Hello,
 I have Apache w/modperl running on my NT box.  The box has Samba on it, and
 I can see my Unix volumes from my SGI box.
 
 There is a volume there /DISK7 and I would like to be able to use that as a
 kind of Virtual host through the Apache Web server. /DISK7 has a bunch of
 .mov files that instead of copying to the htdocs directory, I would like to
 be able to href link to them and have them displayed.
 
 So my question is, where in the config (or how do I) configure the
 httpd.conf to allow me to use /DISK7 as part of the doc root?
 
 Thanks,
 
 Scott Purcell


i think you may have to mount it
mount -t smb -o username=user,password=pass //ntserver//disk7
/mnt/smbshare

then just add /mnt/smbshare to doc root!



RE: Virtual Host?

2001-09-10 Thread Rob Bloodgood


 i think you may have to mount it
 mount -t smb -o username=user,password=pass //ntserver//disk7
 /mnt/smbshare

 then just add /mnt/smbshare to doc root!

Except that, to the best of my knowledge, Samba can only mount to regular
mount points on Linux.

Rob

#!/usr/bin/perl -w
use Disclaimer qw/:standard/;





name-based virtual host -suexec: command not in docroot

2001-07-02 Thread Oliver

Hello All,
I'm using name-based virtual hosts on Apache 1.3.19

I need to run a cgi from one of the virtual hosts, but I get the following
errors:
suexec.log - command not in docroot (/path/to/cgi)
error.log - Premature end of script headers: /path/to/cgi

Anyone know why and what I should do? Thanks!
Please Help. 
Oliver Etzel, Munich




RE: name-based virtual host -suexec: command not in docroot

2001-07-02 Thread David Harris


 I need to run a cgi from one of the virtual hosts, but I get the following
 errors:
 suexec.log - command not in docroot (/path/to/cgi)
 error.log - Premature end of script headers: /path/to/cgi

Suexec is compiled with a built in path which all requests must fall
underneath as part of the security model. This isn't related to name based
hosting, but rather to the document root path you are using.

Read more about the suexec security model here:
http://httpd.apache.org/docs/suexec.html#model

David





i use linux+apache. how to create a cgi-bin directory for Virtual Host?

2001-06-09 Thread ydok




my system is build on linux+apache
now i'm create virtual hosts.i change the 
config file (/opt/apache/conf/httpd.conf)like
this:
# get the server name from the Host: 
headerUseCanonicalName Off# this log format can be split 
per-virtual-host based on the first fieldLogFormat "%V %h %l %u %t \"%r\" %s 
%b" vcommonCustomLog logs/access_log vcommon
# include the server name in the filenames used to satisfy 
requestsVirtualDocumentRoot /www/hosts/%0/VirtualScriptAlias 
/www/hosts/%0/cgi-bin


now i try to browse the virtual host ,i canget http://www.1.com/test.htm (which is in 
/www/hosts/www.1.com/,) but can not get http://www.1.com/test.pl .(which is in 
/www/hosts/www.1.com/cgi-bin),the system can't find the file.

yet i can get http://localhost/cgi-bin/test.pl,(which is 
in /opt/apache/cgi-bin),why?

by the way,i need create many virtual host,so i 
mustdo dynamic creating like 
above.


@INC per virtual host

2000-09-18 Thread HotMail: Bill

Greetings,

Can the perl include path be configured on a per virtual host basis?

-Bill



perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan

Greetings,

Is it possible to setup different Initialization per virtual host?

so perhaps one:
PerlRequire /usr/local/www_sh/conf/startup.pl

per virtual host, each different.

-Bill Deegan



Re: perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan

Ged,

I think you may have misunderstood.

I meant a different startup per virtual host, not per child process.

Is that possible?

-Bill
- Original Message - 
From: "G.W. Haywood" [EMAIL PROTECTED]
To: "William Deegan" [EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 1:16 PM
Subject: Re: perl initialization per virtual host... is it possible


 Hi there,
 
 On Thu, 14 Sep 2000, William Deegan wrote:
 
  Is it possible to setup different Initialization per virtual host?
  
  so perhaps one:
  PerlRequire /usr/local/www_sh/conf/startup.pl
  
  per virtual host, each different.
 
 No, startup.pl is run before the server forks any children.  But you
 can have lots of different servers running on the one machine.  Then
 you could have a proxy which feeds to the appropriate server depending
 on the URI.
 
 Would that do it, or would it be too painful?
 
 73,
 Ged.
 
 
 




Re: perl initialization per virtual host... is it possible

2000-09-14 Thread Ime Smits



| I meant a different startup per virtual host, not per child process.

It's perfectly ok to specify a PerlRequire for each virtual host
or even in .htaccess, but I think that's a dirty habbit to get
into. As the complete perl namespace is shared between all
your virtual hosts there is  really no benifit, just drawbacks:
modules required before Apache forks off will result in all
childs using a single copy of that module, but required modules
after that will load a copy for each child process.

Ime




Re: perl initialization per virtual host... is it possible

2000-09-14 Thread David Hodgkinson


"William Deegan" [EMAIL PROTECTED] writes:

 Ged,
 
 I think you may have misunderstood.
 
 I meant a different startup per virtual host, not per child process.
 
 Is that possible?

If you're going to do that, say, to stop virtual servers interfering
with each other, consider having COMPLETELY different fat servers
hidden behind your thin one.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan


- Original Message - 
From: "Ime Smits" [EMAIL PROTECTED]
To: "William Deegan" [EMAIL PROTECTED]
Cc: "G.W. Haywood" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 2:26 PM
Subject: Re: perl initialization per virtual host... is it possible


 
 
 | I meant a different startup per virtual host, not per child process.
 
 It's perfectly ok to specify a PerlRequire for each virtual host
 or even in .htaccess, but I think that's a dirty habbit to get
 into. As the complete perl namespace is shared between all
 your virtual hosts there is  really no benifit, just drawbacks:
 modules required before Apache forks off will result in all
 childs using a single copy of that module, but required modules
 after that will load a copy for each child process.


When I do that a "SetEnv" in my virtual host doesn't seem to get
passed to the startup.pl...

Is that the expected behavior?

-Bill




Cookies and Virtual Host ServerName

2000-05-12 Thread William Rico



I encountered a weird problem while writing a 
simple authentication handler (based on TicketTool from the eagle book again : 
). 

My virtual hostwas setup as 
follows...
VirtualHost 192.168.100.2DocumentRoot 
/usr/local/apache/htdocsServerName mydomain
...
/VirtualHost

In my authentication handler I tried setting a 
cookie with a command like this:
$r-err_headers_out-add('Set-Cookie' = 
"easy=123; domain=mydomain");

However,Apache would not send the cookie to 
the server. When I removed the "domain" setting from the cookie, it 
worked, and sent over a cookie with domain "mydomain" which is exactly what I 
was trying to achieve when explicitly setting the domain. Why wouldn't 
Apache send my original cookie?

After some more testing, I realized that setting my 
VirtualHost up with a fully qualified ServerName also solves the problem. 
In other words, changing the virtual host to this:

VirtualHost 192.168.100.2DocumentRoot 
/usr/local/apache/htdocsServerName www.mydomain.com
...
/VirtualHost

...allows me to set the domain in my cookie (e.g. "domain=mydomain.com") 
and have it sent. Checking the Apache documentation, I found that the 
syntax for ServerName requires it to be fully qualified. However, not 
using a fully qualified domain name seems to work for other purposes, and I 
can't figure out the reason for a conflict with cookies. I know it's not 
going to get the lost hair back on my head, but I'd still like to understand 
what's going on.

Thanks,
Will




Re: Perl Sections and Virtual Host

2000-04-20 Thread Doug MacEachern

i've only skimmed this thread, but haven't seen any mention of chapter 8
online at http://modperl.com/ which covers Perl sections in detail.




Re: Perl Sections and Virtual Host

2000-04-19 Thread Pierre-Yves BONNETAIN


  my $realname = 'http://www.main.org';
  my %vnames = ( 'sec.ondary.com' = 'second', 'third.dom.com' = 'third' );
  ^^^
  foreach (keys %vnames) {
 ^^^
  $VirtualHost{'192.168.1.2:80'} = {
  ServerName = $_,
  RedirectPermanent = ( ['/', "$realname/$vname{$_}/index.phtml"] )
   ^^

 Maybe this is just in your example, but you might have cut-and-pasted from
 yor config, so I'll mention it: In your RedirectPermanent, you are referencing
 %vname, not %vnames. Without strict turned on in your Perl section, Perl 
 won't tell you.

   Yep, I caught this one a few minutes ago (but if I had read my mail earlier,
your message would have saved half of my day. Well, there are times like 
that...).

   I'm getting somewhat closer, I think it's now just a matter of understanding
more precisely 'what' should be used as the RedirectPermanent value. This
work just fine now :

Perl
my $realname = 'real.domain.com';

my %vnames = ( 'prim.ary.com' = 'first', 'sec.ondary.com' = 'second' );

$VirtualHost{'192.168.1.2:80'} = [ { ServerName = $realname } ];

foreach (keys %vnames) {
my $vhref = {
ServerName = $_,
RedirectPermanent = "/ http://$realname/$vnames{$_}/"
};

push @{$VirtualHost{'192.168.1.2:80'}}, $vhref;
}
/Perl

   Whenever I ask for http://prim.ary.com, I get transparently redirected to
http://real.domain.com/first. Cute. Almost there.

   But I have other URLs I want to remap. Say, prim.ary.com/europe should be
mapped to real.domain.com/europe. With the above setup, I am redirected to
real.domain.com/first/europe. So I need now to have _several_ RedirectPermanent
(or anything that could save my whole day -- well, night, it's 23 pm here).
   I have tried a helluva lot of syntaxes, I'm ashamed to say, to no avail. The
right one just escapes me.
   Any hints ?
   Tia,
-- Pierre-Yves BONNETAIN
   CTO -- http://www.rouge-blanc.com  --  Fastest wines in Europe.




Perl Sections and Virtual Host

2000-04-18 Thread Pierre-Yves BONNETAIN

   Hello modperlers,

   I'm currently banging my head on the walls trying to use Perl sections, in
the httpd.conf file, to configure virtual hosts. The idea is to redirect lots
of 'secondary' domains to URLs on our 'main' website.
   Let's say the main website is www.main.org, and secondary domain are
sec.ondary.com and third.dom.com. With a regular Virtual host config, no
sweat (well, it seems so; maybe an Apache expert will tell me I forgot
something big and important :-)

NameVirtualHost 192.168.1.2:80

VirtualHost 192.168.1.2:80
ServerName  sec.ondary.com
RedirectPermanent / http://www.main.org/second/index.phtml
/VirtualHost

VirtualHost 192.168.1.2:80
ServerName  third.dom.com
RedirectPermanent / http://www.main.org/third/index.phtml
/VirtualHost

   Since we have several secondary domains, and lots of URLs to remap in
different ways depending on the secondary domain, I thought going through a
Perl section would be cute. So, dumbly, I wrote this to replace the 
VirtualHost sections above (the NameVirtualHost does not change) :

Perl
my $realname = 'http://www.main.org';
my %vnames = ( 'sec.ondary.com' = 'second', 'third.dom.com' = 'third' );
foreach (keys %vnames) {
$VirtualHost{'192.168.1.2:80'} = {
ServerName = $_,
RedirectPermanent = ( ['/', "$realname/$vname{$_}/index.phtml"] )
}
}
/Perl

   No way. No errors during the server startup, but also no redirection
whatsoever. Where am I wrong, or what did I forget ?
   I'm using
  Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) mod_perl/1.21
  mod_ssl/2.4.9 OpenSSL/0.9.4
   Tia,
-- Pierre-Yves BONNETAIN
   CTO
   http://www.rouge-blanc.com -- Fastest wines in Europe