python cgi nginx_nginx uwsgi和cgi python脚本

我遇到了问题.我有一个python脚本.你可以称之为CGI脚本.它在Apache2下工作正常,但在关闭系统之前只剩下一个它永远运行.新系统使用nginx.

我按照许多人的建议配置uwsgi,同时搜索解决方案,配置虚拟主机以运行此脚本.

我在uwsgi wiki上使用了第一个例子来确认我已经正确配置了nginx,它可以与uwsgi进行通信.像魅力一样工作.

现在我的并发症:

我的脚本是前一段时间编写的,不是为WSGI设计的,我也不想/可以重写它.

所以我已经为uwsgi安装了cgi模块并尝试使用它.我得到的只是502错误.什么都没有执行uwsgi.

这是我用于此应用程序的配置:

[uwsgi]

plugins = cgi

socket = 127.0.0.1:9010

cgi = /=/usr/share/test/

cgi-allowed-ext = .py

cgi-helper = .py=python

这是我在index.py(测试脚本)中的代码:

#!/usr/bin/python

print "Content-type: text/html

"

print "

It works!

"

我尝试使用以下命令测试uwsgi:

/usr/sbin/uwsgi --http :9011 --ini /etc/uwsgi/test.ini --master

这是我得到的输出:

[uWSGI] getting INI configuration from /etc/uwsgi/test.ini

*** Starting uWSGI 1.1.2 (64bit) on [Fri Apr 20 15:26:33 2012] ***

compiled with version: 4.4.6 20110731 (Red Hat 4.4.6-3) on 19 April 2012 15:09:37

current working directory: /home/user

detected binary path: /usr/sbin/uwsgi

your memory page size is 4096 bytes

detected max file descriptor number: 1024

lock engine: pthread mutexes

uWSGI http bound on :9011 fd 3

uwsgi socket 0 bound to TCP address 127.0.0.1:9010 fd 6

your server socket listen backlog is limited to 100 connections

*** Operational MODE: single process ***

initialized CGI mountpoint: / = /usr/share/test/

*** no app loaded. going in full dynamic mode ***

*** uWSGI is running in multiple interpreter mode ***

spawned uWSGI master process (pid: 6727)

spawned uWSGI worker 1 (pid: 6728, cores: 1)

spawned uWSGI http 1 (pid: 6729)

-- unavailable modifier requested: 0 --

-- unavailable modifier requested: 0 --

-- unavailable modifier requested: 0 --

-- unavailable modifier requested: 0 --

哪里有问题?请帮忙.

提前致谢.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值