Forum Moderators: phranque
Secondly, the way our Apache install is set up is not of my choosing- we went with a shared hosting platform that uses service drivers between hosted components and uses some awkward ways of file storage and username conventions.
I've recently installed cgiwrap, and my global /cgi-bin is set as /usr/local/apache/cgi-bin. Now I'm trying to allow my virtual hosts to use their cgi-bins (/export/home/site/cgi-bin) with cgiwrap. The catch is that the Virtual Host files are set up like this:
<VirtualHost webserverIP:80>
ServerAdmin siteA@siteA.myISP.net
DocumentRoot /export/home/siteA
ServerName siteA.myISP.net
ServerAlias domain1.net *.domain1.net
Action cgi-wrapper /cgi-bin/cgiwrap/siteA
CustomLog /export/users/siteA/logs/access_log combined
</VirtualHost>
<VirtualHost webserverIP:80>
ServerAdmin siteB@siteB.myISP.net
DocumentRoot /export/home/siteB
ServerName siteB.myISP.net
ServerAlias domain2.net *.domain2.net
Action cgi-wrapper /cgi-bin/cgiwrap/siteB
CustomLog /export/users/siteB/logs/access_log combined
</VirtualHost>
Therefore, I need rewrite to change [domain1.net...] to [domain1.net...] and [domain2.net...] to [domain2.net...] Is such a thing possible without using a mapfile with entries for each virtual host (I have hundreds of virtual hosts)?
UseCanonicalName is set to On, ExecCGI has been allowed for /export/home/*/cgi-bin/, and all virtual hosts are defined in their own conf file (vhosts.conf). Any ideas?
Welcome to WebmasterWorld [webmasterworld.com]!
I may be missing some important factor here, but one purpose of mod_rewrite is allow URLs and filepaths to have nothing in common. As long as you don't need to change the domain name, a purely-internal rewrite can be used to redirect any URL to any filepath within the "account's" web space on the server.
I'd encourage you to try some experimentation. The only problem I see is in making it easy to handle your many virtual hosts in an efficient way. The more 'standardized' their URL- and filepath naming conventions are, the easier it will be to accomplish your goal with a minimum or RewriteRules.
For example, in httpd.conf, the following code
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]*)\.
RewriteRule ^/cgi-bin/(.*)$ /cgi-bin/cgiwrap/%2/$1 [L]
Jim
RewriteCond %{SERVER_NAME} ^([^.]*)\.mysisp\.net
RewriteRule ^/cgi-bin/(.*)$ /cgi-bin/cgiwrap/%1/$1 [L]
Jim
The rewrite is working fine, but it looks like I have more of a problem with cgiwrap working after the rewrite. If I comment out the rewrite, cgiwrap works. The cgiwrap log file doesn't even register an attempt when the redirect occurs. I think it's a problem with my directory settings within the httpd.conf file; when a rewrite is involved, is the cgi script running from the original referenced path, or the path returned after the conversion? I installed cgiwrap --with-cgi-bin=cgi-bin.
That depends on how it's implemented (I don't know), but you are on the right track, as this is a *very* common problem with redirecting when scripts (or even custom error documents) are involved.
Jim