Uwsgi starts from root but not as a service

Posted by vittore on Server Fault See other posts from Server Fault or by vittore
Published on 2013-10-25T00:53:13Z Indexed on 2013/10/25 3:57 UTC
Read the original article Hit count: 908

Filed under:
|

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 ?

© Server Fault or respective owner

Related posts about nginx

Related posts about uwsgi