unbit / uwsgi-docs

Official uWSGI docs, examples, tutorials, tips and tricks
MIT License
639 stars 346 forks source link

django and nginx is broken #34

Closed ashwin31 closed 11 years ago

ashwin31 commented 11 years ago

i may be wrong but the tutorial is not working for me https://github.com/unbit/uwsgi-docs/blob/master/tutorials/Django_and_nginx.rst

its not working when i tried to run uwsgi --http :8000 --wsgi-file test.py

uwsgi: unrecognized option '--wsgi-file'

i ran the command as root let me know what i did wrong

prymitive commented 11 years ago

It looks like You don't have python plugin compiled in or loaded. What build configuration did You used? I never used pip to install uWSGI (if this is what You did), but check if You got python development packages installed, maybe they are missing and this is why it is not compiled.

ashwin31 commented 11 years ago

according to the tutorial they said to install uwsgi with pip

pip install uwsgi

i did exactly the same as in the tutorial.

i used ubuntu 12.10

prymitive commented 11 years ago

Do You have python-dev package installed? Please paste whole uWSGI startup log

ashwin31 commented 11 years ago

wow it started working. i installed python-dev, python-virtualenv and pip install uWSGI.

thank you for help. i will get back if i run into errors again.

ashwin31 commented 11 years ago

hi again i got an error bad gateway in http://racsoft.in:8000

and the log says

2013/01/15 10:36:25 [error] 11598#0: 1 connect() failed (111: Connection refused) while connecting to upstream, client: 49.204.62.99, server: racsoft.in, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "racsoft.in:8000" 2013/01/15 10:36:27 [error] 11598#0: 1 connect() failed (111: Connection refused) while connecting to upstream, client: 49.204.62.99, server: racsoft.in, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "racsoft.in:8000"

my mysite_nginx.conf file is

upstream django {

server unix:///path/to/your/mysite/mysite.sock; # for a file socket

server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

server { listen 8000; server_name racsoft.in; charset utf-8;

client_max_body_size 75M;   # adjust to taste

location /media  {
    alias /home/ubuntu/uwsgi-tutorial/mysite/mysite/media;
}

location /static {
    alias /home/ubuntu/uwsgi-tutorial/mysite/mysite/static;
}

location / {
    uwsgi_pass  django;
    include     /home/ubuntu/uwsgi-tutorial/mysite/uwsgi_params;
    }
}
prymitive commented 11 years ago
2013/01/15 10:36:25 [error] 11598#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 49.204.62.99, server: racsoft.in, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "racsoft.in:8000"

You configured nginx to use uwsgi://127.0.0.1:8001 but You are running uWSGI with http port on 8000. Replace --http :8000 with --socket :8001 and it should work.

ashwin31 commented 11 years ago

thank you, the error was with uwsgi, it was not running. i thought just nginx will do magic like it does to php. then i ran uwsgi it worked very good. now im at the end trying with emperor. thank you very much.

ashwin31 commented 11 years ago

hi

i struck at rc.local part i tried a lot. but failed. can you help me with upstart configuration on ubuntu 12.10

prymitive commented 11 years ago

If You need help with something send an email to uWSGI mailing list, github is meant for bug reports

ashwin31 commented 11 years ago

ok i will send a mail but you please note that the rc.local part in the tutorial is not working for me. i think it not for ubuntu servers is it so?

prymitive commented 11 years ago

It looks valid to me. If it doesn't work for You than there is no way of telling why unless You provide some logs or error messages. It requires that You have working uwsgi binary in /usr/local/bin/, application config files inside /etc/uwsgi/vassals directory, and www-data user account with www-data group. Your system might be configured differently.

ashwin31 commented 11 years ago

i took a plain ami instance suggested by ubuntu http://cloud-images.ubuntu.com/releases/quantal/release/ for amazon ec2 and configured exactly as mention in the tutorial.

thanks for your patience.