0

I have setup an Nginx server with following configuration:

server {
        listen 8080;
        server_name localhost;

        location / {
                include uwsgi_params;
                uwsgi_pass unix:/tmp/uwsgi.notesapi.socket;
                uwsgi_param UWSGI_PYHOME /home/ubuntu/notesAPI/env;
                uwsgi_param UWSGI_CHIDIR /home/ubuntu/notesAPI/src;
                uwsgi_param UWSGI_SCRIPT Notes;
        }

}

I have setup a bottle app with initial following initial script:

import sys from settings.constants import PROJECT_ROOT print PROJECT_ROOT sys.path.insert(0, PROJECT_ROOT)

import bottle from bottle import Bottle, debug from settings import routes

Notes = Bottle() routes.set(Notes)

debug(True)
if __name__ == '__main__':
    Notes.run(host='0.0.0.0', port=8080, reloader=True)
else:
    application = bottle.default_app()

When I send a GET request to the server I get a 404 even though the routes are perfectly set.

Here is the uwsgi.log:

[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini

[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/uwsgi.ini

Fri Jun 21 04:47:26 2013 - * Starting uWSGI 1.0.3-debian (64bit) on [Fri Jun 21 04:47:26 2013] *

Fri Jun 21 04:47:26 2013 - compiled with version: 4.6.3 on 17 July 2012 02:26:54

Fri Jun 21 04:47:26 2013 - current working directory: /

Fri Jun 21 04:47:26 2013 - writing pidfile to /run/uwsgi/app/uwsgi/pid

Fri Jun 21 04:47:26 2013 - detected binary path: /usr/bin/uwsgi-core

Fri Jun 21 04:47:26 2013 - setgid() to 33

Fri Jun 21 04:47:26 2013 - setuid() to 33

Fri Jun 21 04:47:26 2013 - your memory page size is 4096 bytes

Fri Jun 21 04:47:26 2013 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/uwsgi/socket fd 5

Fri Jun 21 04:47:26 2013 - uwsgi socket 1 bound to UNIX address /tmp/uwsgi.notesapi.socket fd 6

Fri Jun 21 04:47:26 2013 - Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]

Fri Jun 21 04:47:26 2013 - Set PythonHome to /home/ubuntu/notesAPI/env

Fri Jun 21 04:47:26 2013 - Python main interpreter initialized at 0x1f27e60

Fri Jun 21 04:47:26 2013 - your server socket listen backlog is limited to 100 connections Fri Jun 21 04:47:26 2013 - * Operational MODE: preforking *

Fri Jun 21 04:47:26 2013 - added /home/ubuntu/notesAPI/src/ to pythonpath.

Fri Jun 21 04:47:26 2013 - * no app loaded. going in full dynamic mode *

Fri Jun 21 04:47:26 2013 - * uWSGI is running in multiple interpreter mode *

Fri Jun 21 04:47:26 2013 - spawned uWSGI master process (pid: 25575)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 1 (pid: 25583, cores: 1)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 2 (pid: 25584, cores: 1)

/home/ubuntu/notesAPI/src

Fri Jun 21 04:55:28 2013 - WSGI application 0 (mountpoint='') ready on interpreter 0x1f27e60 pid: 25583 (default app) [pid: 25583|app: 0|req: 1/1] 117.196.135.124 () {44 vars in 686 bytes} [Fri Jun 21 04:55:28 2013] GET / => generated 723 bytes in 188 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)

I am pretty new to uwsgi and nginx. I can't seem to figure out the problem.

Roald Nefs
  • 1,302
  • 10
  • 29
mahesmohan
  • 784
  • 1
  • 13
  • 33
  • "even though the routes are perfectly set" -- how do you know? – ron rothman Jun 22 '13 at 03:16
  • I've tried t locally. And works fine there. – mahesmohan Jun 22 '13 at 06:05
  • "Locally" in what sense? Sorry, I don't get what you mean. Maybe if you show us your route definitions in the question, it'll be clearer? – ron rothman Jun 22 '13 at 13:43
  • Sorry. By locally I meant that I have setup a virtualenv and setup the bottle server in my machine. And it runs smoothly. But there I make use of the uwsgi server that is present in Bottle. And also there is no nginx. – mahesmohan Jun 22 '13 at 18:57

1 Answers1

1

Are you sure that NGINX and UWSGI are working properly? Lot's of things could be wrong, I recommend you to follow this guide: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

It's a step by step to setup NGINX and UWSGI with Django but I'm pretty sure you can apply it to any other web app than Django.

dablak
  • 1,376
  • 1
  • 11
  • 21