PDA

View Full Version : cgi-bin assistance please



dwarfzilla
07-15-2007, 05:43 AM
I am in the process of moving my reseller hosting / design biz from another host (nameless for now, at least until my migration is over) to WH, so far I extremely pleased with both WH and the quality of assistance I see here in the forums! Thanks in advance for any help!

I find myself a little rusty in some areas and could really use some advice / help with a few secondary domain cgi-bin questions, I have read some of the other posts relating to this but I think I am a little dense, or at least in need of more coffee this morning......

I have gone the route of
/www/domain1
/www/domain2
/www/domain3, and so on

I would like to have seperate cgi-bins for each, the tree looking like /www/domain3/cgi-bin.

when editing the httpd.conf file what exactly will the additions look like, assuming the tree above ?

<VirtualHost *:80>
ServerName domain3.com
ServerAlias www.domain3.com
ScriptAlias /cgi-bin/ "/www/domain3/cgi-bin/"
<Directory "/www/domain3/cgi-bin/">
Options ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>
DocumentRoot /www/domain3/
</VirtualHost>


Maybe I should just cut down a tree with a herring.... or taunt my scripts a second time

wildjokerdesign
07-15-2007, 09:38 AM
I am working on writeing up a solution for you. Saw you on and thought I would let you know. :)

wildjokerdesign
07-15-2007, 09:48 AM
Welcome to WestHost. :)

The first thing I see that you don't need the way you have things set up is:

ScriptAlias /cgi-bin/ "/www/domain3/cgi-bin/"
A ScriptAlias would be used if your cgi-bin directory was not "really" located at /www/domain3/cgi-bin.

When I set up a secondary domain I reproduce the structure that WH uses by default for the main domain. First thing I want to point out in how you have things set up is that /www is a symbolic link to /var/www. I try to use only "real" absolute paths. So if I was doing what you are doing I would set the DocumentRoot to /var/www/domain3/html/. I would then create /var/www/domain3/cgi-bin/. Now you would want to use the ScriptAlias now that the cgi-bin for your domain3 is not really located in your DocumentRoot. Here is an example of what your VirtualHost for domain would then need to look like.


<VirtualHost *>
ServerName domain3.com
ServerAlias www.domain3.com
DocumentRoot /var/www/domain3/html/

<Directory "/var/www/domain3/html">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh

AllowOverride All
Order allow,deny
Allow from all
</Directory>

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/domain3/cgi-bin">
#AllowOverride None
AllowOverride AuthConfig
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

That would pretty much let your secondary domains function in the same way your main domain does. in the Directory tag for /var/www/domain3/html you well notice the three lines:

AllowOverride All
Order allow,deny
Allow from all
Those make it possible to use .htaccess for your secondary domain.

wildjokerdesign
07-15-2007, 09:49 AM
If you make these changes and still have problems then make sure that you have uploaded your perl/cgi script in ASCII mode and that you have changed the permissions to 755.