Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82583
| References | <m6pl11$b7$1@dont-email.me> |
|---|---|
| Date | 2014-12-16 17:20 +0100 |
| Subject | Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? |
| From | Chris Warrick <kwpolska@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16999.1418746849.18130.python-list@python.org> (permalink) |
On Tue, Dec 16, 2014 at 4:01 PM, Veek M <vek.m1234@gmail.com> wrote:
> Has anyone got the thing to work? I want to run some python database scripts
> on nginx. Because that will have a simple web-UI, i decided to go with
> uWSGI. It's proving to be a massive pain.
>
> I found a decent book for nginx and got that bit working. The query gets
> sent to uWSGI but for some reason it can't find my script.
>
> Most of the documentation on the web is utterly horrid and will take a 4
> year PhD to understand. I don't undertsand the architecture of uWsgi - he's
> got a bunch of modules and I don't undertsand what exactly is going on
> inside it!
>
> less /etc/nginx/sites-enabled/default
> location / {
> include uwsgi_params;
> uwsgi_pass unix:/run/uwsgi/app/uwsgi/sockete;
> uwsgi_param UWSGI_PYHOME /usr/share/nginx/cgi;
> uwsgi_param UWSGI_CHDIR /usr/share/nginx;
> uwsgi_param UWSGI_SCRIPT index; #NOT SURE WHAT THIS DOES?
>
>
> less /etc/uwsgi/apps-enabled/uwsgi.ini
> [uwsgi]
> plugins=python
> socket=/tmp/uwsgi.socket
> pythonpath=/usr/share/nginx/cgi/
>
> Tue Dec 16 20:43:21 2014 - Python main interpreter initialized at 0x95cde0
> Tue Dec 16 20:43:21 2014 - your server socket listen backlog is limited to
> 100 connections
> Tue Dec 16 20:43:21 2014 - *** Operational MODE: preforking ***
> Tue Dec 16 20:43:21 2014 - added /usr/share/nginx/cgi/ to pythonpath.
> Tue Dec 16 20:43:21 2014 - *** no app loaded. going in full dynamic mode ***
> Tue Dec 16 20:43:21 2014 - *** uWSGI is running in multiple interpreter mode
> ***
> Tue Dec 16 20:43:21 2014 - spawned uWSGI master process (pid: 18792)
> Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 1 (pid: 18818, cores: 1)
> Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 2 (pid: 18819, cores: 1)
>
>
> ::1 - - [16/Dec/2014:21:08:03 +0530] "GET /foo.py HTTP/1.1" 502 172 "-"
> "Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0"
> --
> https://mail.python.org/mailman/listinfo/python-list
This is NOT how uwsgi works! You cannot use plain .py files with it,
and for good reason — CGI should be long dead.
What you need to do is, you must write a webapp — in Flask, for
example. Then you must craft an .ini file that mentions this.
With the http://flask.pocoo.org/ demo as /var/flask/hello.py
(copy-pasting from my working site):
--- nginx config --
location {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
}
--- /etc/uwsgi/apps-enabled/hello.ini ---
[uwsgi]
emperor = true
socket = 127.0.0.1:3031
chdir = /var/flask/
master = true
threads = 5
module = %n
callable = app
plugins = python
uid = http
gid = http
processes = 3
--- If /var/flask is a virtualenv, add:
binary-path = /var/flask/bin/uwsgi
virtualenv = /var/flask
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-16 21:31 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Chris Warrick <kwpolska@gmail.com> - 2014-12-16 17:20 +0100
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 08:01 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 08:28 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 09:57 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 19:45 +0630
csiph-web