I have a Python script which contains:
from flup.server.fcgi import WSGIServer
def processRequest(environ, start_response):
# proprietary business logic here
return
WSGIServer(
application = processRequest,
bindAddress = ('0.0.0.0', 6543),
umask = 0
).run()
I run this Python script from the command line on an ubuntu 12.04.2 LTS server with Python 2.7.3.
On that same server, I have lighttpd version 1.4.28 configured with
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_setenv",
"mod_fastcgi",
"mod_accesslog"
)
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/ssl/secret.pem"
server.document-root = "/var/www"
fastcgi.server = (
"/MyFCGI/" =>
((
"host" => "127.0.0.1",
"port" => 6543,
"check-local" => "disable"
))
)
}
When I request https://TheEffKyouDeeEnn/MyFCGI/blah/blahblah as a POST with a JSON object, the system behaves the way I would expect and passes my request through to the Python script running on the command line.
I need to configure that same functionality on an MS-Windows Server machine running Apache 2.2. I want to preserve the ability to deploy my Python script anywhere on the network, instead of only on the server with the Apache instance. Although the documentation seems to indicate that's possible, using at least mod_fcgid, I can't make it work myself and can't find a working example.
Can you confirm that mod_fcgid is the appropriate module and give an example of how to configure Apache and mod_fcgid to duplicate my lighttpd behavior?
This duplicates the same functionality with Apache2.2.
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so VirtualHost *:80 DocumentRoot /var/www/ Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Headers "Content-type" Header set Access-Control-Allow-Methods "POST,GET,OPTIONS" AliasMatch ^/MyFCGI/.*$ /var/my_fcgi.py Directory /MyFCGI/ Options FollowSymLinks +ExecCGI AllowOverride All SetHandler fastcgi-script /Directory FastCgiExternalServer /var/my_fcgi.py -host localhost:6543 /VirtualHost