我按照这个在 Gentoo 上安装和配置 Nginx、uWSGI 和 Django。在最后一步之前一切看起来都很好:Nginx 返回 502 Bad Gateway 错误并且以下内容出现在 uWSGI 日志中:
*** Starting uWSGI 1.2.4 (32bit) on [Mon Sep 10 23:41:29 2012] ***
compiled with version: 4.5.3 on 02 September 2012 22:00:55
detected number of CPU cores: 2
current working directory: /var/www/localhost/htdocs/mysite
writing pidfile to /var/run/uwsgi/trac.pid
detected binary path: /usr/bin/uwsgi
your memory page size is 4096 bytes
building mime-types dictionary from file /etc/mime.types...1017 entry found
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
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: 14105)
spawned uWSGI worker 1 (pid: 14108, cores: 1)
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
谷歌指出了这一点,但对于 Ubuntu。Gentoo 上的软件包的等效项是什么uwsgi-plugin-python
?
/etc/nginx/nginx.conf
location /mysite {
root /var/www/localhost/htdocs/mysite/polls;
uwsgi_pass 127.0.0.1:8001;
include uwsgi_params;
}
/etc/conf.d/uwsgi.trac
UWSGI_SOCKET="127.0.0.1:8001"
UWSGI_THREADS=0
UWSGI_PROGRAM=/var/www/localhost/htdocs/mysite/polls/tests.py
UWSGI_XML_CONFIG=
UWSGI_PROCESSES=1
UWSGI_LOG_FILE=/var/log/uwsgi/django.log
UWSGI_CHROOT=
UWSGI_DIR=/var/www/localhost/htdocs/mysite/
UWSGI_USER=uwsgi
UWSGI_EMPEROR_PATH=
UWSGI_EXTRA_OPTIONS=
首先,确保
uwsgi
安装时python
启用了 USE 标志:其次,编辑 init 脚本并将
UWSGI_EXEC
变量更改为/usr/bin/uwsgi_python27
而不是/usr/bin/uwsgi
:然后重新启动并重
uwsgi
试。仅供申请。只需在插件中设置所需的 python 版本。
示例
/etc/uwsgi.d/mysite.ini
: