Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have nginx + uwsgi setup for flask website.

thats my nginx

server {
listen 80;
server_name _;

location /static/ {
    alias /var/www/site/app/static/;
}

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

And here is my uwsgi config.xml

<uwsgi>
<socket>127.0.0.1:5080</socket>
<autoload/>
<daemonize>/var/log/uwsgi_webapp.log</daemonize>
<pythonpath>/var/www/site/</pythonpath>
<module>run:app</module>
<plugins>python27</plugins>
<virtualenv>/var/www/venv/</virtualenv>
<processes>1</processes>
<enable-threads/>
<master />
<harakiri>60</harakiri>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-rss>192</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>

When I trying to start uwsgi service (service uwsgi start) it says ok but there is no uwsgi process and I see the following in the log:

*** Starting uWSGI 1.0.3-debian (64bit) on [Fri Oct 25 00:43:13 2013] ***
compiled with version: 4.6.3 on 17 July 2012 02:26:54
current working directory: /
writing pidfile to /run/uwsgi/app/gsk/pid
detected binary path: /usr/bin/uwsgi-core
setgid() to 33
setuid() to 33
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be         rejected on post-unbuffered webservers *** 
uwsgi socket 0 bound to TCP address 127.0.0.1:5080 fd 6
bind(): Permission denied [socket.c line 107]

However when I start uwsgi as a root

uwsgi --socket 127.0.0.1:5080 --module run --callab app --harakiri 15 --harakiri-verbose --logto2 tmp/uwsgi.log

It starts just fine and after restarting nginx I can access website.

What can be an issue ?

share|improve this question
    
fwiw upgrade as soon as possible, anything older than uWSGI 1.4 is unmaintained, utterly old (more than 2 years) and with tons of known bugs –  roberto Oct 25 '13 at 6:05
    
@roberto thanks! –  vittore Oct 25 '13 at 10:55

1 Answer 1

Now that's really stupid. I spend several hours trying to figure that out and I found a reason right after I posted this. There is a bug which made me try to add uid and gid to config:

<uwsgi>
<socket>127.0.0.1:5080</socket>
<autoload/>
<daemonize>/var/log/uwsgi_webapp.log</daemonize>
<pythonpath>/var/www/site/</pythonpath>
<module>run:app</module>
<plugins>python27</plugins>
<virtualenv>/var/www/gsk/</virtualenv>
<processes>1</processes>
<uid>www-data</uid>
<gid>www-data</gid>
<enable-threads/>
<master />
<harakiri>60</harakiri>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-rss>192</reload-on-rss>
<no-orphans/>
<vacuum/>
</uwsgi>

After adding those, it started and after restarting nginx it just works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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