AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 426039
Accepted
quanta
quanta
Asked: 2012-09-11 08:52:18 +0800 CST2012-09-11 08:52:18 +0800 CST 2012-09-11 08:52:18 +0800 CST

nginx + uwsgi: -- 请求不可用修饰符:0 --?

  • 772

我按照这个在 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=
nginx
  • 2 2 个回答
  • 10524 Views

2 个回答

  • Voted
  1. Best Answer
    quanta
    2012-09-11T09:02:32+08:002012-09-11T09:02:32+08:00

    首先,确保uwsgi安装时python启用了 USE 标志:

    [I] www-servers/uwsgi
         Available versions:  ~1.0.2.1 ~1.2.3-r3 ~1.2.3-r4 (~)1.2.4 {apache2 +caps +carbon cgi debug elibc_FreeBSD erlang gevent graylog2 json ldap lua +nagios +pcre perl php php_targets_php5-3 php_targets_php5-4 +python rrdtool rsyslog ruby ruby_targets_ree18 ruby_targets_ruby18 ruby_targets_ruby19 spooler sqlite syslog +xml yaml zeromq}
         Installed versions:  1.2.4(10:01:48 PM 09/02/2012)(apache2 caps carbon cgi ldap nagios pcre php_targets_php5-3 python ruby_targets_ruby18 ruby_targets_ruby19 xml -debug -elibc_FreeBSD -erlang -gevent -graylog2 -json -lua -perl -php -php_targets_php5-4 -rrdtool -rsyslog -ruby -ruby_targets_ree18 -spooler -sqlite -syslog -yaml -zeromq)
         Homepage:            http://projects.unbit.it/uwsgi/
         Description:         uWSGI server for Python web applications
    

    其次,编辑 init 脚本并将UWSGI_EXEC变量更改为/usr/bin/uwsgi_python27而不是/usr/bin/uwsgi:

    PROGNAME=${SVCNAME#*.}
    
    #UWSGI_EXEC=/usr/bin/uwsgi
    UWSGI_EXEC=/usr/bin/uwsgi_python27
    PIDPATH=/var/run/uwsgi
    PIDFILE="${PIDPATH}/${PROGNAME}.pid"
    

    然后重新启动并重uwsgi试。

    • 2
  2. igraltist
    2014-09-14T05:53:00+08:002014-09-14T05:53:00+08:00

    仅供申请。只需在插件中设置所需的 python 版本。

    示例/etc/uwsgi.d/mysite.ini:

    [uwsgi]
    plugins = python27
    
    • 2

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve