Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Aug 06, 2004 1:29 am 
Offline
Senior Newbie

Joined: Sun Apr 18, 2004 3:30 am
Posts: 19
Hi,

Quick question... I am trying to have a cgi-bin setup for cgi scripts that my virtualhosts have access to using
Code:
ScriptAlais /cgi-bin/ "/path/to/public/cgi-bin"

While this is fairly easily achieved, but at the same time I'd also like to have private cgi-bins for each of my virtual hosts in <VirtualHost> by using
Code:
 ScriptAlias /cgi-bin/ "/path/to/virtualhost/cgi-bin/"


I have tested this method and have had strange results... such as "www.vir_host_domain.com/cgi-bin/program.cgi" returning a 404 Not Found message. BUT if I enter "mail.vir_host_domain.com/cgi-bin/program.cgi", it's finds the path fine!!

Is what I am trying to do even possible? Basically I just want a public cgi-bin and a private one. Too much to ask of apache?

I am running slackware 10 (small) w/ apache 1.3.31.

Thank you...


Top
   
 Post subject:
PostPosted: Fri Aug 06, 2004 1:23 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2004 11:30 am
Posts: 140
Location: England, UK
It should certainly work, yes. My guess is there's something else going on.

What do the <VirtualHost> sections in your httpd.conf look like?


Top
   
 Post subject:
PostPosted: Sat Aug 07, 2004 1:51 pm 
Offline
Senior Newbie

Joined: Sun Apr 18, 2004 3:30 am
Posts: 19
Thanks for your reply.... Here's how my <VirtualHost> directive looks like...

Code:
<VirtualHost *>
ServerName www.virtualhost_domain.com
ServerAlias virtualhost_domain.com
ServerAdmin postmaster@virtualhost_domain.com
ScriptAlias /cgi-bin/ /home/virtualhost_domain/cgi-bin/
DocumentRoot /home/virtualhost_domain/public_html
ErrorLog /home/virtualhost_domain/logs/error_log
CustomLog /home/virtualhost_domain/logs/access_log common
<Directory /home/virtualhost_domain/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks
</Directory>
</VirtualHost>


This is how ScriptAlias looks like for the public cgi-bin in the [IfModule] directive:

Code:
ScriptAlias /cgi-bin/ "/home/www/cgi-bin/"
<Directory "/home/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>


Is this how I should be defining the private "ScriptAlias" for the virtualhost's own cgi-bin?


Top
   
 Post subject:
PostPosted: Sun Aug 08, 2004 10:32 am 
Offline
Senior Member

Joined: Fri Feb 13, 2004 11:30 am
Posts: 140
Location: England, UK
My experience has been that it's far easier (ie. less hassle) to define *all* hosts as VirtualHosts, otherwise things are just weird. In my experience, when VirtualHosts are used, the first one defined is used as the main host. So, what I would suggest first is making sure that any directives such as ScriptAlias, etc, appear only in VirtualHost tags. Basically, the best idea is to remove as many host-specific things from the main part of httpd.conf as you can, including things like ScriptAlias. The stuff like AddModule, etc. aren't host-specific, so they can stay there.

So basically, you want to set up *two* VirtualHost tags, the first one being the main site and the second being the private one. That doesn't sound like it should work, but using VirtualHosts in combination with another host defined outside of a VirtualHost tag can cause weird problems, so it might well work for you. Give it a go, and let me know how it works out. If it doesn't work out, post what you have, and then we can try some more. :D


Top
   
 Post subject:
PostPosted: Sun Aug 08, 2004 12:07 pm 
Offline
Senior Newbie

Joined: Mon Jun 28, 2004 4:42 pm
Posts: 9
WLM: jasonwhitaker@yahoo.com
I agree. I have always had better luck by defining all possible hosts as virtual hosts. Here is some fun reading on the 1.3 host directives: http://httpd.apache.org/docs/vhosts/details.html and the first one in the examples link shows pretty much that idea of having the main host respond to nothing: http://httpd.apache.org/docs/vhosts/examples.html


Top
   
 Post subject:
PostPosted: Sun Aug 08, 2004 3:51 pm 
Offline
Senior Newbie

Joined: Sun Apr 18, 2004 3:30 am
Posts: 19
Simply magical! Thanks guys... Here's what I did....

In the main_host, I commented out
Code:
#ScriptAlias /cgi-bin/ "/path/to/main_host/cgi-bin/"
    #<Directory "/path/to/cgi-bin">
     #   AllowOverride None
     #   Options None
     #   Order allow,deny
     #   Allow from all
    #</Directory>


And then I took that same code into my vhost file and did:
Code:
<VirtualHost *>
ServerName *
ServerAlias *
ScriptAlias /cgi-bin/ /path/to/main_host/cgi-bin/
<Directory /path/to/main_host/cgi-bin>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


And keeping the vhost directive the way it was:
Code:
<VirtualHost *>
ServerName www.my_vhost.com
ServerAlias my_vhost.com
ScriptAlias /cgi-bin/ /path/to/my_vhost/cgi-bin/
DocumentRoot /path/to/my_vhost/public_html
ErrorLog /path/to/my_vhost/logs/error_log
CustomLog /path/to/my_vhost/logs/access_log common
<Directory /path/to/my_vhost/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks
</Directory>
</VirtualHost>

And now it seems to be responding to both the main_host cgi scripts as well as vhost's own! Thank you guys! :o


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group