nginx + uwsgi: -- unavailable modifier requested: 0 --

nginx windows
nginx wiki
nginx vs apache
nginx tutorial
nginx reverse proxy
nginx pronounce
nginx open source
nginx location

Ubuntu 12.04, nginx 1.2.0, uwsgi 1.0.3.

I start uwsgi with the following command:

uwsgi -s 127.0.0.1:9010 -M -t 30 -A 4 -p 4 -d /var/log/uwsgi.log

On each request nginx replies with 502 and uwsgi writes to log the following line:

-- unavailable modifier requested: 0 --

Original answer

For Python 2 on Ubuntu 11.10, using upstart, install the python plugin for uWSGI with apt-get install uwsgi-plugin-python and if you're using an ini file to configure your uWSGI app, then add plugins = python to the [uwsgi] section and it should solve this problem.

Edit: Updated for Python 3 and Ubuntu 17.10

For Python 3 on Ubuntu 17.10, using systemd, install the python plugin for uWSGI with apt-get install uwsgi-plugin-python3 and if you're using an ini file to configure your uWSGI app, then add plugins = python to the [uwsgi] section and it should solve this problem.

For more information on getting started with python/uWSGI apps, including how to configure them using an ini file then please take a look at this handy guide

Welcome to NGINX Wiki!, nginx news. 2020-05-28. unit-1.18.0 version has been released, featuring file system isolation and several behind-  njs-0.4.0 version has been released, featuring js_import directive and multi-value headers support in r.headersOut. nginx-1.17.10 mainline version has been released. 2020-03-12 unit-1.16.0 version has been released, featuring round-robin load balancing and fallback routing options.

Solved by installing uwsgi-plugin-python3 plugin and adding --plugin python3 option to uwsgi start command

nginx news, Nginx, pronounced like “engine-ex”, is an open-source web server that, since its initial success as a web server, is now also used as a reverse  nginx: download Add OWASP Top 10 security-as-a service to your app or website in 5 minutes with F5 Essential App Protect.

Im starting uwsgi from upstart on Ubuntu. I solved the problem by running apt-get install uwsgi-plugin-python, and then adding plugins=python to my application.ini in /etc/uwsgi/applications-available.

Nginx, Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP  Nginx (pronounced "engine X", / ˌɛndʒɪnˈɛks / EN-jin-EKS) (stylized as NGINX or nginx or NginX) is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and first publicly released in 2004.

from http://uwsgi-docs.readthedocs.org/en/latest/ThingsToKnow.html, "To route requests to a specific plugin, the webserver needs to pass a magic number known as a modifier to the uWSGI instances. By default this number is set to 0, which is mapped to Python."

I'm using 9 for a bash script and it's working. the numbers and their meanings are on this page: http://uwsgi-docs.readthedocs.org/en/latest/Protocol.html

in my nginx configuration:

location ~ .cgi$ {
    include uwsgi_params;
    uwsgi_modifier1 9;
    uwsgi_pass 127.0.0.1:3031;
}

Nginx, nginx (pronounced "engine x") is a free open source web server written by Igor Sysoev, a Russian software engineer. Since its public launch in 2004, nginx has​  Nginx, pronounced like “engine-ex”, is an open-source web server that, since its initial success as a web server, is now also used as a reverse proxy, HTTP cache, and load balancer.

I'm using Ubuntu 18.04 with Python 3. Below is the exact config I used to get it working.

You must have the Python 3 uWSGI plugin installed:

apt install uwsgi-plugin-python3

Your Nginx site configuration should point to your uWSGI socket. Make sure the port matches the configuration in the later steps.

    location / {
        uwsgi_pass 127.0.0.1:9090;
        include uwsgi_params;
    }

Reload the Nginx config to reflect the changes you just made:

systemctl reload nginx

You can use command-line arguments or an ini file for configuration. I created uwsgi.ini. Make sure the socket address matches your nginx config.

[uwsgi]
socket = 127.0.0.1:9090
chdir = /var/www
processes = 4
threads = 2
plugins = python3
wsgi-file = /var/www/app.py

My app.py just has a basic example:

def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/plain')])
    return [b"Hello World!"]

Now start the uWSGI server from the command line:

uwsgi uwsgi.ini

What Is Nginx? A Basic Look at What It Is and How It Works, NGINX Config - The easiest way to configure a performant, secure, and stable nginx server. With NGINX now configured as the reverse proxy, open a browser and point it to the address of the server hosting the proxy. The address should automatically be redirected to the address you set

nginx, NGINX, Inc. We’re supporting a community where more than 31 million* people learn, share, and work together to build software.

The Architecture of Open Source Applications (Volume 2): nginx, nginx is the web server that's replacing Apache in more and more of the world's websites. Until now, nginx has not been able to benefit from the security ModSecurity provides. Here's how to install ModSecurity and get it working with nginx.

NGINX Config, Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage.

Comments
  • On Ubuntu uwsgi is started as a service: service uwsgi start.
  • The equivalent of this (yum plugin install + uwsgi config change) just worked for me on CentOS7.
  • Have been breaking my head, unable to fix this issue. Thank you !
  • What about alpine linux?
  • I don't know where the file is for the "individual uwsgi app config". Could you be more specific? Is this my uwsgi app's ini file? The /etc/something file? Maybe paste a sample of what the file contents look like so I know what you are referring to? And a typical location for the file?
  • It's been quite a while since I had to worry about this (7 years in fact) but I do indeed mean the uwsgi app's ini file. As you can probably imagine, I no longer have any config files lying around but a quick google search produced this (seemingly) handy guide. As for the location of the ini file, it could realistically live almost anywhere. If you were feeling particularly adventurous you could even serve up that ini file from another web server anywhere in the world, like so: uwsgi --ini http://uwsgi.it/configs/myapp.ini
  • Please write wide answer with more details and set question as resolved with @SHaKie answer