I've done before many setups of both uWSGI for django applications and flask for python-plugin under ubuntu along with Nginx as web server. I've always done it in one box..

As now, we are having a security need to separate application servers from web servers. I cannot seem to find a way to get it to work, uWSGI sockets not accessible beyond local host.

Below is an example to one setup

uWSGI / domain.ini

vhost = true
plugins = python
master = true
enable-threads = true
processes = 1
wsgi-file = /app/xx-env/xx/rr/misc/settings/sites/default/wsgi.py
virtualenv = /app/xx-env/
chdir = /app/snowflake-env/rr
touch-reload = /app/xx-env/xx/rr/misc/settings/sites/default/uwsgi-reload

Here is my nginx conf

server {
        listen 80;
        server_name xx.example.com websrv-a.example.com;
        access_log /var/log/nginx/access.xx.log;
        error_log /var/log/nginx/error.xx.log;

        location / {
                try_files $uri @uwsgi;
        location @uwsgi {
            include uwsgi_params;

Any ideas on how I could accomplish this? any hints would be very much appreciated.

  • You can telnet 9002, testing the network reachable or not – orangleliu Feb 22 at 8:20

Your nginx configuration is trying to pass to port 9002, but your uWSGI is configured to listen on port 9001. One of these two needs to be changed so that the ports match.

You also need to ensure that the host firewalls permit the traffic between your servers.

  • my bad, i was typing manually. I will correct the question now – Mo J. Mughrabi May 22 '13 at 2:30

apparently there is nothing wrong in your config. Check your networking topology and firewall rules. You may want to attach a strace to uWSGI processes to see if there is some traffic hitting them

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.