Using this deployment tutorial, I'm trying to get an Ubuntu 12.04 server up and running with Flask, uWSGI and Nginx. I now have trouble getting Nginx to run. When I try to (re)start nginx it simply says ...fail!, and when I run a test (using sudo nginx -t), it says:

nginx: [emerg] unknown directive "uwsgi_param" in /etc/nginx/uwsgi_params:1
nginx: configuration file /etc/nginx/nginx.conf test failed

I didn't change anything in that file, so its contents are the default ones:

uwsgi_param     QUERY_STRING            $query_string;
uwsgi_param     REQUEST_METHOD          $request_method;
uwsgi_param     CONTENT_TYPE            $content_type;
uwsgi_param     CONTENT_LENGTH          $content_length;

uwsgi_param     REQUEST_URI             $request_uri;
uwsgi_param     PATH_INFO               $document_uri;
uwsgi_param     DOCUMENT_ROOT           $document_root;
uwsgi_param     SERVER_PROTOCOL         $server_protocol;
uwsgi_param     UWSGI_SCHEME            $scheme;

uwsgi_param     REMOTE_ADDR             $remote_addr;
uwsgi_param     REMOTE_PORT             $remote_port;
uwsgi_param     SERVER_PORT             $server_port;
uwsgi_param     SERVER_NAME             $server_name;

My server definition in /etc/nginx/sites-available/www looks like this:

server {
    listen 8080;
    server_name myapp;

    root /var/www/myapp;
    try_files $uri @uwsgi;
    location @uwsgi {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/myapp.sock;

Does anybody know what I'm doing wrong here? Why doesn't this run? All tips are welcome!


The fix for me was as simple as:

sudo apt-get install nginx-full

The version of nginx installed doesn't support UWSGI. It's fairly easy to find one that does:

% apt-cache search nginx uwsgi
nginx-core - nginx web/proxy server (core version)
nginx-extras - nginx web/proxy server (extended version)
nginx-full - nginx web/proxy server (standard version)

That means all of those packages contain uwsgi in their package descriptions, which is usually in the positive sense. You can verify that simply by looking at the description, e.g. apt-cache show packagename.

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.