bottle+uwsgi+nginx ?

I'm a n00b using FreeBSD and having problems getting everything to work properly.

Installed www/nginx, www/uwsgi, and sysutils/py-supervisor based on instructions found here -

However I am having difficulties getting my bottle app to display properly.

Running uwsgi alone with --ini myapp.ini works but with nginx I am getting 502 error.

My uwsgi file:
module = wsgihandler
socket =
master = true
chmod-socket = 664
uid = www
gid = www
#enable-threads = true
proesses = 4
socket-timeout = 180
post-buffering = 8192
max-requests = 1000
buffer-size = 32768
wsgi-file = /usr/local/www/myapp/
myapp.conf (inside conf.d folder)
upstream myapp {
server unix:///var/run/uwsgi_myapp0.sock;
server unix:///var/run/uwsgi_myapp1.sock;
server unix:///var/run/uwsgi_myapp2.sock;
server unix:///var/run/uwsgi_myapp3.sock;
server unix:///var/run/uwsgi_myapp4.sock;
server {
listen 3031;
server_name localhost;

location / {
uwsgi_pass myapp;
include uwsgi_params;
Anyone who can help a lost soul?
Last edited by a moderator:
From a logical point of view and given your uwsgi file, I would expect to see something like the following in your myapp.conf file :
upstream myapp {
    server ;
since you do not use sockets.

--- Edit --
Or even shorter (see here):
location / {
    include uwsgi_params;
I just realized that your nginx server is listening on the same port than your application. You should set the nginx to listen on port 80 or at least not on 3031. Have a look to the official documentation.

Thanks for your replies and I really do appreciate it. Ports and sockets are all new to me =) I have started all over and instead of trying to follow online "how to" I am now starting from scratch, one thing at a time and reading. Will be writing back on my progress.
I have managed to run a bottle base app with uwsgi, now I need to configure nginx, and supervisor.
Last edited by a moderator: