1

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? :|

1

Is the CGI plugin installed ?

Running CGI scripts on uWSGI

With the same configuration I can reproduce the error, but after installing the CGI plugin and run using the new binary in /tmp/uwsgi it works:

curl http://uwsgi.it/install | bash -s cgi /tmp/uwsgi
  • Thankyou for pointing that out. Is "uwsgi-plugin-cgi" the package i need to install. Like "apt-get install uwsgi-plugin-cgi"? – Archer Mar 18 '15 at 17:53
  • Thank you my friend. Thats what i had missed. Thank you very much !!!! :] [ignore my previous comment] – Archer Mar 18 '15 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.