Configuring Apache to serve python cgi script

pehr anderson pehr at pehr.net
Thu Aug 17 02:18:31 EDT 2000


My guess is that you want is to use the script-alias directive

ScriptAlias /cgi-bin/  /path/to/cgi-bin/

I've got a fairly involved apache config script 
where I use different rewrite rules inside each
virtual domain definition so my box serves multiple
zope sites on different domains, in addition to normal
apache and cgi services.


ScriptAlias /mailman/ 	"/home/mailman/cgi-bin/"

VirtualHost 24.218.234.247>
	ServerName www.osm.cx
	RewriteEngine On

	# make /~username and /icons the standard ones
	RewriteOptions 'inherit'
	RewriteRule ^/~(.*)		- [last]
	RewriteRule ^/icons(.*)  	- [last]

	# inherit standard mailman aliases
	RewriteRule ^/mailman(.*)  	- [last]
	RewriteRule ^/pipermail(.*)	- [last]

	# redirect everything else (and its reverse) 
	RewriteRule ^/(.*)$ 		http://localhost:8080/osm/$1 [proxy]
	ProxyPassReverse / 		http://localhost:8080/osm/

	# redirect two zope directories since they aren't in /osm
	ProxyPass 	 /p_		http://localhost:8080/p_
	ProxyPass	 /misc_		http://localhost:8080/misc_
</VirtualHost>




	-pehr

Andres Corrada-Emmanuel wrote:
> 
> Hi,
> 
> I'm using Apache+Zope to serve up a website. In addition, I want to be
> able to serve regular cgi scripts.
> 
> This is all being accomplished by the use of the mod_rewrite module in Apache. So I have a rule that goes like this:
> 
> RewriteRule ^/cgi-bin/(.*) /path/to/cgi-bin/$1 [t=application/x-httpd-cgi]
> 
> The problem is that this triggers Netscape to save the file instead of
> executing the file.
> 
> This has me stumped because there is a similar rule that serves the Zope content and it also sets the type to "application/x-httpd-cgi" and it gets executed properly.
> 
> Why is this happening? How do I fix it? Thank you.
> 
> Andres Corrada



More information about the Python-list mailing list