deploy django with nginx

2016-07-15 Thread 1351552...@qq.com
hi everyone:

I am tring to deploy my site by nginx and uwagi
in my project yaohang,i have these files:

#yaohang_uwsgi.ini
[uwsgi] 
socket = :8001 
chmod-socket= 664
master = true 
module = yaohang_uwsgi 
processes = 8 
listen = 120 
enable-threads = true 
daemonize = /home/wangwei/yaohang/yaohang_uwsgi.log 
pidfile = /home/wangwei/yaohang/yaohang_uwsgi.pid 
pythonpath = /home/wangwei/yaohang/ 
pythonpath = /home/wangwei/yaohang/yaohang_uwsgi 
pythonpath = /home/wangwei/yaohang/yaohang 
buffer-size = 32768 
reload-mercy = 8 
vacuum = true

#yaohang_uwsgi.py
import os 
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yaohang.settings") 

from django.core.wsgi import get_wsgi_application 
application = get_wsgi_application()

#yaohang_uwsgi.conf
server { 
listen  8000;
server_name192.168.70.32; # this is my server's addr
charset UTF-8; 

client_max_body_size 75M; 

location / { 
include uwsgi_params; 
uwsgi_pass 127.0.0.1:8001; 
uwsgi_read_timeout 2; 
}
location /static { 
expires 30d; 
autoindex on; 
add_header Cache-Control private; 
alias /home/wangwei/yaohang/static/; 
} 
}   

run nginx and 
>>uwsgi --http 192.168.70.32:8001 --wsgi-file yaohang_uwsgi.py

and then by my client browser:192.168.70.32:8000
it show:502 Bad Gateway

and with the message in file /var/log/nginx/error.log :
connect() to unix:///home/wangwei/yaohang/yaohang.sock failed (13: Permission 
denied) while connecting to upstream, client: 192.168.71.3, server: 
192.168.70.32, request: "GET / HTTP/1.1", upstream: 
"uwsgi://unix:///home/wangwei/yaohang/yaohang.sock:", host: "192.168.70.32:8000"

who can tell me where is wrong?

thank you!

wblueboat
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/201607151847061918789%40qq.com.
For more options, visit https://groups.google.com/d/optout.


Re: deploy django with nginx

2016-07-15 Thread Rafael E. Ferrero
I used this link without any trouble
https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-14-04


Rafael E. Ferrero

2016-07-15 7:47 GMT-03:00 1351552...@qq.com <1351552...@qq.com>:

> hi everyone:
>
> I am tring to deploy my site by nginx and uwagi
> in my project yaohang,i have these files:
>
> #yaohang_uwsgi.ini
> [uwsgi]
> socket = :8001
> chmod-socket= 664
> master = true
> module = yaohang_uwsgi
> processes = 8
> listen = 120
> enable-threads = true
> daemonize = /home/wangwei/yaohang/yaohang_uwsgi.log
> pidfile = /home/wangwei/yaohang/yaohang_uwsgi.pid
> pythonpath = /home/wangwei/yaohang/
> pythonpath = /home/wangwei/yaohang/yaohang_uwsgi
> pythonpath = /home/wangwei/yaohang/yaohang
> buffer-size = 32768
> reload-mercy = 8
> vacuum = true
>
> #yaohang_uwsgi.py
> import os
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yaohang.settings")
>
> from django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
>
> #yaohang_uwsgi.conf
> server {
> listen  8000;
> server_name192.168.70.32; # this is my server's addr
> charset UTF-8;
>
> client_max_body_size 75M;
>
> location / {
> include uwsgi_params;
> uwsgi_pass 127.0.0.1:8001;
> uwsgi_read_timeout 2;
> }
> location /static {
> expires 30d;
> autoindex on;
> add_header Cache-Control private;
> alias /home/wangwei/yaohang/static/;
> }
> }
>
> run nginx and
> >>uwsgi --http 192.168.70.32:8001 --wsgi-file yaohang_uwsgi.py
>
> and then by my client browser:192.168.70.32:8000
> it show:502 Bad Gateway
>
> and with the message in file /var/log/nginx/error.log :
> connect() to unix:///home/wangwei/yaohang/yaohang.sock failed (13:
> Permission denied) while connecting to upstream, client: 192.168.71.3,
> server: 192.168.70.32, request: "GET / HTTP/1.1", upstream:
> "uwsgi://unix:///home/wangwei/yaohang/yaohang.sock:", host: "
> 192.168.70.32:8000"
>
> who can tell me where is wrong?
>
> thank you!
>
> wblueboat
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/201607151847061918789%40qq.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJJc_8UxOJ0j%3DoCTyho744Qvie8U7NiMTZ%3D4OmC16--_j5aaNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: deploy django with nginx

2016-07-15 Thread Javier Guerra Giraldez
On 15 July 2016 at 11:47, 1351552...@qq.com <1351552...@qq.com> wrote:
> and with the message in file /var/log/nginx/error.log :
> connect() to unix:///home/wangwei/yaohang/yaohang.sock failed (13:
> Permission denied


check under what user is running nginx, and make sure that it has r/w
permissions on that socket

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoQ8WW-JS-pKLz4SN8QNp0e%3DQGUjg0pOVvXsKsGNc0mNig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.