nginx和uwsgi配置问题

nginx和uwsgi配置问题,nginx,uwsgi,Nginx,Uwsgi,将uwsgi与uwsgi文件参数一起使用时,我可以在127.0.0.1/hello.py处看到正确呈现的页面: plugin = python3 master = true processes = 5 chdir = /var/www/web1/ http = 127.0.0.1:9090 wsgi-file = /var/www/web1/hello.py stats = 127.0.0.1:9191 chmod-socket = 777 vacuum = true enable-thread

将uwsgi与uwsgi文件参数一起使用时,我可以在127.0.0.1/hello.py处看到正确呈现的页面:

plugin = python3
master = true
processes = 5
chdir = /var/www/web1/
http = 127.0.0.1:9090
wsgi-file = /var/www/web1/hello.py
stats = 127.0.0.1:9191
chmod-socket = 777
vacuum = true
enable-threads  = true
die-on-term = true
但是当我使用

location ~ \.py$ {
    try_files $uri /index.py =404;
    proxy_pass http://127.0.0.1:9090;
    include uwsgi_params;
}
并禁用uwsgi文件参数:

plugin = python3
master = true
processes = 5
chdir = /var/www/web1/
http = 127.0.0.1:9090
#wsgi-file = /var/www/web1/hello.py
stats = 127.0.0.1:9191
chmod-socket = 777
vacuum = true
enable-threads  = true
die-on-term = true
然后我得到这些错误:

浏览器-“内部服务器错误”

nginx控制台-“GET/hello.py HTTP/1.1”500 32

uwsgi控制台-“GET/hello.py=>在0毫秒内生成21个字节(HTTP/1.0 500)在83个字节内生成2个标头(核心0上的0个开关)”


我可以得到一些帮助来解决此问题吗?请

解决方案需要uWSGI运行CGI脚本:

  • 启用CGI插件并根据配置uwsgi ini文件
  • 使用uwsgi\u modifier19参数配置nginx反向代理
  • 这种类型的“hello world”测试:

    #!/usr/bin/env python
    print "Content-type: text/html\n\n"
    print "<h1>Hello World</h1>"
    
    #/usr/bin/env python
    打印“内容类型:text/html\n\n”
    打印“Hello World”
    
    解决方案需要uWSGI运行CGI脚本:

  • 启用CGI插件并根据配置uwsgi ini文件
  • 使用uwsgi\u modifier19参数配置nginx反向代理
  • 这种类型的“hello world”测试:

    #!/usr/bin/env python
    print "Content-type: text/html\n\n"
    print "<h1>Hello World</h1>"
    
    #/usr/bin/env python
    打印“内容类型:text/html\n\n”
    打印“Hello World”