httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zac Stevens <...@cryptocracy.com>
Subject Re: [users@httpd] VirtualDirectory
Date Thu, 30 Jan 2003 02:27:29 GMT
On Thu, Jan 30, 2003 at 12:56:11AM +0100, Subzero wrote:
> I can't run the script from the cgi-bin dir itself.. itäs a ikonboard forum
> that i am trying to make the VirtualDrectory for.. instead of
> www.domain.com/cgi-bin/ikonboard/ i want forum.domain.com..
> So, i need to have the ikonboard.pl file in the cgi-bin/ikonboard/ dir..
> but the wierd thing is, that when i use www.domain.com/cgi-bin/ikonboard/ it
> works perfect and when i use forum.domain.com it doesn't process the file..

This thread seems to be a little bit confused, but I'll throw my 2 cents in
and hope I don't muddy the waters further :)

First, a quick note - there is no such thing as a "VirtualDirectory" in
Apache.  I understand this to be an IIS term roughly equivalent to Apache's
'Alias', but that doesn't really make sense in the context you're using it.

Now, there's two ways of solving the problem at hand.  The first is using
VirtualHosts, while the second uses mod_rewrite.  I don't use mod_rewrite
much, so I tend to use VHosts in this situation.

Generally speaking, I would not create a VHost whose DocumentRoot was
located underneath another VHost's DocumentRoot.  It is conceptually
simpler to be able to see a VirtualHost as an entirely separate entity in
its own right.  eg,

# main server
C:\Program Files\Apache Group\Apache\htdocs
C:\Program Files\Apache Group\Apache\cgi-bin
# forums
C:\Program Files\Apache Group\Apache\forum\htdocs
C:\Program Files\Apache Group\Apache\forum\cgi-bin

...and so on.  In your case, where you need a VirtualHost to run a single
CGI (more or less), a separate cgi-bin is not required.  I think something
along the lines of the following would probably work:

<VirtualHost *>
   ServerName dir.domain.com
   ServerAdmin webmaster@dir.domain.com

   DocumentRoot "C:/Program Files/Apache Group/Apache/forum/"

   ErrorLog logs/dir.domain.com-error_log
   CustomLog logs/dir.domain.com-access_log common

   <Directory "C:/Program Files/Apache Group/Apache/forum/">
	Options -Indexes +ExecCGI
	AddHandler cgi-script .pl
   </Directory>
</VirtualHost>

You would then put the ikonboard files into the path specified as the
DocumentRoot above.

That's the VirtualHosting option.

As for mod_rewrite, you would keep a single VirtualHost and add a 
ServerAlias for 'dir.domain.com'.  Then you would need a couple of rules to
proxy requests for http://dir.domain.com/ to
http://www.domain.com/cgi-bin/ikonboard/ - the documentation for
mod_rewrite includes a number of good examples, so if you're interested in
going down this path you can probably find something there.


Zac

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