I've run into issue. I have a python script. You can call it CGI script. It works fine under Apache2, but is only one left before I shutdown system it runs forever. New system uses nginx. I've configured uwsgi as suggested by many while searching on solution, configured virtual host for this script to run. I've used first example on uwsgi wiki to confirm I have properly configured nginx and it can communicate with uwsgi. Worked like charm.
Now my complications:
My script was written some time ago and is not designed for WSGI, nor I want/can rewrite it.
So I've installed cgi module for uwsgi and tried using it. All I get is 502 errors. Nothing being executed uwsgi.
Here is my config I'm using for this app:
[uwsgi]
plugins = cgi
socket = 127.0.0.1:9010
cgi = /=/usr/share/test/
cgi-allowed-ext = .py
cgi-helper = .py=python
Here is code I have in index.py (test script):
#!/usr/bin/python
print "Content-type: text/html\n\n"
print "<html><body><h1>It works!</h1></body></html>"
I try to test uwsgi with following command:
/usr/sbin/uwsgi --http :9011 --ini /etc/uwsgi/test.ini --master
And here is output I get:
[uWSGI] getting INI configuration from /etc/uwsgi/test.ini
*** Starting uWSGI 1.1.2 (64bit) on [Fri Apr 20 15:26:33 2012] ***
compiled with version: 4.4.6 20110731 (Red Hat 4.4.6-3) on 19 April 2012 15:09:37
current working directory: /home/user
detected binary path: /usr/sbin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread mutexes
uWSGI http bound on :9011 fd 3
uwsgi socket 0 bound to TCP address 127.0.0.1:9010 fd 6
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
initialized CGI mountpoint: / = /usr/share/test/
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 6727)
spawned uWSGI worker 1 (pid: 6728, cores: 1)
spawned uWSGI http 1 (pid: 6729)
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
Where is problem? Please help.
Thanks in advance.