httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garrison <...@acm.org>
Subject [users@httpd] Sharing a CGI script from multiple directories?
Date Tue, 29 Oct 2002 05:33:13 GMT
I'm looking for a way to share a single CGI script from many
directories in apache.  I have a Perl CGI script called 'album.cgi'
that generates a photo album (index pages and image pages).  I want
to have various photo albums in different directories, for example:

public_html/
    cgi-bin/
       album.cgi
    album1/
       album.cfg
       images/
       thumbs/
    album2/
       album.cfg
       images/
       thumbs/
    etc...

This is currently running under apache 1.3.27, with a VirtualHost
directive defining the document root as my public_html directory:

    <VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /home/myuserid/public_html
    BytesLog domlogs/mydomain.com-bytes_log
    User myuserid
    Group mygroupid
    ServerName www.mydomain.com
    CustomLog domlogs/mydomain.com combined
    ScriptAlias /cgi-bin/ /home/myuserid/public_html/cgi-bin/
    </VirtualHost>

/home/myuserid/public_html/.htaccess contains:

    Options -Indexes +ExecCGI +FollowSymLinks
    DirectoryIndex album.cgi index.html index.cgi

What I want to have happen is the following:

1) User browses to, for example, www.mydomain.com/album1

2) Apache looks in album1/.htaccess for album-specific
    authentication requirements (may or may not be present).

3) Apache then invokes a single shared copy of album.cgi
    to generate the album index page

So far, the only way I've been able to make this work is to put a
copy of album.cgi, or a hard link to the one in public_html/cgi-bin,
in each album directory. I want to avoid duplicate copies or hard
links if possible.

Symbolic links would be acceptable, and I tried them yesterday. It
worked fine for one day, and then my ISP changed something and it
quit working.

I suspect there's probably a much better way to do this than what
I've tried so far. How would an apache guru fulfill the requirments
stated above? Some form of URL rewriting?  Any suggestions on how to
proceed?  Pointers to existing solutions?

Thanks in advance.
-- 
Jim Garrison (jhg@acm.org)
PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88


---------------------------------------------------------------------
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


Mime
View raw message