I have a Windows XP machine that has Apache installed via a VisualSVNServer installation. I am . trying to get a simple python cgi script to run in my browser e.g. http://build.procepts.com.au:8080/hg/cgi-bin/test.cgi. However despite trying all the recommended approaches the browser only ever displays the plain text from the cgi script. Amongst many other attempted solutions I have followed the instructions contained here. My ultimate aim is to be able to use the Apache web server to serve repositories from a new Mercurial installation. Seeing as Apache is already installed from VisualSVNServer I thought I might as well make use of it. Is there some other trick to get this working?
The apache server that comes with VisualSVNServer is a minimal build supporting just enough to serve SVN repositories. It does not include cgi support.
That said, it's pretty easy to add cgi support (or any other module for that matter).
For CGI support specifically, you'll need to obtain "mod_cgi.so" built for Apache 2.2 Win32 and place it in "C:\Program Files\VisualSVN Server\bin", then add:
LoadModule cgi_module bin/mod_cgi.so
ScriptAlias /cgi-bin/ cgi-bin/
to "C:\Program Files\VisualSVN Server\conf\httpd-custom.conf". Restart VisualSVN and it should start working.
I am not sure if it applies to the VisualSVNServer, but in ususal Apache you will need at least the following:
Uncomment loading CGI module in Apache config:
LoadModule cgi_module modules/mod_cgi.so (or similar)
Allow executing of CGI scripts in your directory and add a handler for py scripts:
<Directory /path/to/scripts/directory> Options +ExecCGI AddHandler cgi-script py </Directory>
Insert a shebang line in the executed script:
#!/usr/local/bin/python