के साथ त्रुटि मैं nginx + uwsgi, os - debian (3.1.0-1-amd64 x86_64) nginx 1.1.8-1, uwsgi 0.9 पर django के लिए वेबसर्वर करने का प्रयास करता हूं। 8.3-1 विन्यास:django प्रोजेक्ट के लिए uWSGI + nginx, स्ट्रिंग uwsgi
<uwsgi>
<socket>/tmp/uwsgi.sock</socket>
<process>1</process>
<master/>
<enable-threads/>
<uid>33</uid>
<gid>33</gid>
<pidfile>/tmp/uwsgi.pid</pidfile>
</uwsgi>
फ़ाइल /etc/uwsgi/apps-enabled/webapp.xml में nginx विन्यास
location/{
uwsgi_pass unix:///tmp/uwsgi.sock;
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT webapp;
uwsgi_param UWSGI_CHDIR /data/web/webapp/webapp;
}
सभी projet में/डेटा/वेब/webapp/webapp /, यहां सेटिंग.py, यूआरएल ect। /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 में और GID 33 यह www-डेटा उपयोगकर्ता uwsgi
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]
कैसे अनुमति वे चाहते हैं के रूप में चलाने की कोशिश कर रहा है ? और क्या समस्या .. अगर मैं uwsgi चलाने के रूप में जड़ त्रुटि चला गया है है , और मैं
*** 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)
देखते हैं लेकिन जब मैं सर्वर, ngix रिटर्न 502 त्रुटि पृष्ठ तक पहुँचने का प्रयास। और अधिक: nginx लॉग में अनुमति त्रुटि:
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: "****.****.**"
अगर /tmp/uwsgi.sock के परिवर्तन मालिक क्रम (www-डेटा) में उपयोगकर्ता nginix को उन्होंने लिखा अन्य लॉग
[error] 20739#0: *21 upstream prematurely closed connection while reading response header from upstream,
लेकिन अभी भी त्रुटि 502 (
कैसे इस समस्या को हल? कुछ एक मेरी मदद कर सकते .. वास्तव में उपयोग करने के लिए nginx + uwsgi अपाचे के बजाय चाहते हैं। धन्यवाद
हालांकि, समाधान निकट है :) मैं अब और अधिक टीसीपी सॉकेट का उपयोग करता हूं, uwsgi कॉन्फ़िगरेशन बदलता हूं और कुछ और पैकेज स्थापित करता हूं। एक महत्वपूर्ण विकल्प था --autoload। अब uwsgi इस तरह विन्यास है:
<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 नहीं मुख्य प्रणाली अजगर संस्करण> _ <
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)
वह अजगर 2.6.7 लेकिन मुख्य प्रणाली संस्करण का उपयोग का उपयोग 2.7.2 है और इसके लिए सभी पायथन मॉड्यूल स्थापित हैं, इसलिए लॉग में बहुत सारी त्रुटियां - गैर-अस्तित्व में आयात करने के दोहराए गए प्रयासों में से एक, कई सामान्य त्रुटियों में से एक:
File "/usr/lib/python2.6/dist-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/lib/python2.6/dist-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/lib/python2.6/dist-packages/django/db/utils.py", line 51, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named django_mongodb_engine.base
तो .. uwsgi के लिए पायथन का संस्करण कैसे सेट करें?
ओह .... क्षमा करें। समस्या चली गई: - [uwsgi_python27 -x/etc/uwsgi/ऐप्स-सक्षम/conf और ठीक है! आप सबको धन्यवाद –