Include multiple cgi-bins for virtualhosts?
Quick question… I am trying to have a cgi-bin setup for cgi scripts that my virtualhosts have access to using
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
ScriptAlias /cgi-bin/ "/path/to/virtualhost/cgi-bin/"
I have tested this method and have had strange results… such as "
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…
5 Replies
What do the
<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:
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?
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.
http://httpd.apache.org/docs/vhosts/details.htmlhttp://httpd.apache.org/docs/vhosts/examples.html
In the main_host, I commented out
#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:
<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:
<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!