This is my .ini file to run the uwsgi "pyApp.py"
[uwsgi]
plugins = cgi
socket = 127.0.0.1:9010
cgi = /=/usr/share/test/
cgi-allowed-ext = .py
cgi-helper = .py=python
i have a file "firstapp.py" at location /usr/share/test/firstapp.py Its contents are
#!/usr/bin/python
print "Content-type: text/html\n\n"
print "<html><body><h1>It works! Cool!!</h1></body></html>"
I am running the instance of uwsgi with the command
uwsgi --http :9011 --http-modifier1 9 --ini pyApp.ini --master
I have configured several vhosts using nginx. and one of them must point to directory /usr/share/test/ when there is url having "/cgi-bin/" in it.
The nginx config is - [also the only default one among the others]
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/pythonsite.com/html;
index index.html index.htm;
server_name pythonsite.com www.pythonsite.com;
location / {
try_files $uri $uri/ =404;
}
location /cgi-bin {
include uwsgi_params;
uwsgi_modifier1 9;
uwsgi_pass 127.0.0.1:9010;
}
}
But when i try to access the "cgi" script from the browser via the url
http://pythonsite.com/cgi-bin/firstapp.py
The default URL "pythonsite.com" seems to be working fine but the above URl with "cgi-bin" in it seems to be missing something. I get "502 Bad Gateway". What am i missing. In order to use the python scripts this way?
EDIT:
Also, every time i request the URL http://pythonsite.com/cgi-bin/firstapp.py" in the browser, there is a log on the uwsgi server instance saying
-- unavailable modifier requested: 9 --
EDIT 2:
on the uwsgi logs i get "invalid request block size: 21573 (max 4096)...skip" for 127.0..0.1:9010 and connection was reset on the browser page
and for "127.0.0.1:9011/"; i get "internal Server Error" message on the browser. and uwsgi logs as "--- no python application found, check your startup logs for errors ---"
What can be going wrong? :|