2011-12-14 22 views
7

nginx + uwsgi, os - debian (3.1.0-1-amd64 x86_64) nginx 1.1.8-1, uwsgi 0.9 için web sunucusunu deneyin. 8,3-1 yapılandırma: dosya /etc/uwsgi/apps-enabled/webapp.xml içindedjango projesi için uWSGI + nginx, strting uwsgi ile hata

<uwsgi> 
<socket>/tmp/uwsgi.sock</socket> 
<process>1</process> 
<master/> 
<enable-threads/> 
<uid>33</uid> 
<gid>33</gid> 
<pidfile>/tmp/uwsgi.pid</pidfile> 
</uwsgi> 

nginx yapılandırma

location/{ 
     uwsgi_pass unix:///tmp/uwsgi.sock; 
     include uwsgi_params; 
     uwsgi_param UWSGI_SCRIPT webapp; 
     uwsgi_param UWSGI_CHDIR /data/web/webapp/webapp; 
    } 

tüm projet/data/web/webapp/webapp /, burada setting.py, url vb. /data/web/webapp/webapp/webapp.py

import sys, os 
import django.core.handlers.wsgi 
sys.path.insert(0, '/data/web/webapp/webapp') 
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' 
application = django.core.handlers.wsgi.WSGIHandler() 

uid içinde ve 33 o www-data kullanıcı izni istedikleri kadar

root#uwsgi -s /var/run/uwsgi.sock -x /etc/uwsgi/apps-enabled/webapp.xml

[uWSGI] parsing config file /etc/uwsgi/apps-enabled/webapp.xml 
*** Starting uWSGI 0.9.8.3-debian (64bit) on [Wed Dec 14 21:42:02 2011] *** 
compiled with version: 4.6.1 on 27 July 2011 18:25:51 
writing pidfile to /tmp/uwsgi.pid 
uWSGI running as root, you can use --uid/--gid/--chroot options 
setgid() to 33 
setuid() to 33 
your memory page size is 4096 bytes 
unlink(): Permission denied [socket.c line 38] 
bind(): Address already in use [socket.c line 70] 

olarak uwsgi çalıştırmak deneyin edilir gid ? ve hangi kök hata gitmiş gibi ben uwsgi çalıştırırsanız .. sorun var ve ben

*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your memory page size is 4096 bytes 
uwsgi socket 0 bound to UNIX address /var/run/uwsgi.sock fd 3 
uwsgi socket 1 bound to UNIX address /tmp/uwsgi.sock fd 4 
your server socket listen backlog is limited to 100 connections 
*** Operational MODE: single process *** 
*** no app loaded. going in full dynamic mode *** 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI master process (pid: 20732) 
spawned uWSGI worker 1 (pid: 20733, cores: 1) 

bkz ama 502 hata sayfası döndüren ngix sunucusu erişmeye çalıştığınızda. Ve daha fazlası: nginx günlüklerinde izin hatasını: /tmp/uwsgi.sock değişikliği sahibi zamanında (www-data) kullanıcıyı nginix eğer

2011/12/14 21:57:17 [crit] 20739#0: *1 connect() to unix:///tmp/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 10.10.3.111, server: ******, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock:", host: "****.****.**" 

, yazdığı diğer günlükleri

[error] 20739#0: *21 upstream prematurely closed connection while reading response header from upstream, 

ama hala hata 502 (

Bu sorunun çözümü? bazı biri bana nasıl yardımcı olabileceğini .. gerçekten nginx + uwsgi yerine apache kullanmak istiyorum. sayesinde


Ancak, çözüm yakındadır :) Şimdi ve daha fazla tcp soketi kullanın, uwsgi yapılandırmasını değiştirin ve birkaç paket daha yükleyin. önemli bir seçenekdi - boşaltma.

<uwsgi> 
<module>webapp</module> 
<socket>127.0.0.1:5080</socket> 
<pythonpath>/data/web/webapp/webapp</pythonpath> 
<autoload/> 
<daemonize>/var/log/uwsgi_webapp.log</daemonize> 
<processes>1</processes> 
<uid>33</uid> 
<gid>33</gid> 
<enable-threads/> 
<master/> 
<harakiri>120</harakiri> 
<max-requests>5000</max-requests> 
</uwsgi> 

uwsgi o piton 2.6.7 ama ana sistem sürümünü kullanmak <

option "pythonpath" found in plugin python26_plugin.so 
*** Starting uWSGI 0.9.8.3-debian (64bit) on [Thu Dec 15 22:52:23 2011] *** 
compiled with version: 4.6.1 on 27 July 2011 18:25:51 
uWSGI running as root, you can use --uid/--gid/--chroot options 
setgid() to 33 
setuid() to 33 
your memory page size is 4096 bytes 
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** 
uwsgi socket 0 bound to TCP address 127.0.0.1:5080 fd 4 
Python version: 2.6.7 (r267:88850, Aug 3 2011, 12:02:14) [GCC 4.6.1] 
Python main interpreter initialized at 0xc47df0 
threads support enabled 
your server socket listen backlog is limited to 100 connections 
*** Operational MODE: single process *** 
added /data/web/webapp/webapp/ to pythonpath. 
WSGI application 0 (SCRIPT_NAME=) ready on interpreter 0xc47df0 pid: 22983 (default app) 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI master process (pid: 22983) 
spawned uWSGI worker 1 (pid: 22984, cores: 1) 

değil ana sistem piton sürümünü> _ kullanmak .. diğer sorunu çözmek için kalır: şimdi uwsgi böyle yapılandırmaya sahip 2.7.2 ve tüm python modülleri bunun için yüklendi, bu nedenle günlüğünde çok fazla hata var - pek çok tipik hatanın var olmayan girişimi başarısız girişimleri:

çok .. uwsgi için python sürümünü nasıl ayarladınız?

+1

Ah .... pardon. sorun gitti: - [uwsgi_python27 -x/etc/uwsgi/apps-etkin/conf ve tamam tamam! Hepinize teşekkürler –

cevap

7

unix soketleri dosya izinlerine uymalıdır. So/var/run www-data ile yazılabilir olmalı ve nginx/write/var/run/uwsgi okuyabilmelidir.Eğer şeylerin bu tür aşina değilseniz tcp yuvalarını kullanmalı

çorap

1

how set version of python for uwsgi?

Set seçeneği (bir bağlantı noktası seçin ve hazır) eklentileri uwsgi ayarlarında:

[uwsgi] 
... 
plugins = python27 
... 
İlgili konular