我遇到麻烦了。我有一个python脚本。你可以称之为CGI脚本。它在Apache2下工作得很好,但在我关闭它永远运行的系统之前,它只剩下一个了。新系统使用nginx。 我已经按照许多人的建议在搜索解决方案时配置了uwsgi,为运行此脚本配置了虚拟主机。 我使用了uwsgi wiki上的第一个示例来确认我已经正确配置了nginx,并且它可以与uwsgi通信。很有魅力。
现在我的并发症:
我的脚本是前一段时间写的,不是为WSGI设计的,我也不想/不能重写它。
所以我为uwsgi安装了cgi模块并尝试使用它。我只得到502个错误。没有被执行的东西。
这是我用于此应用程序的配置:
[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\n\n"
print "<html><body><h1>It works!</h1></body></html>"
我尝试用以下命令测试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 --
问题在哪里?请帮忙。
提前谢谢。
好的。我读得不够好。我所要做的就是将
--http-modifier1 9
添加到命令行开关,或者uwsgi_modifier1 9;
添加到nginx配置。相关问题 更多 >
编程相关推荐