如何将Cherrypy wsgi放在Nginx之后? [英] How to put Cherrypy wsgi behind Nginx?

查看:98
本文介绍了如何将Cherrypy wsgi放在Nginx之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在跟踪 lalalalalalalambda示例,将cherrypy放在nginx服务器后面,但是除了我家Debian发行版中的 nginx 502坏网关以外,没有完成任何其他操作. 这是Nginx设置:

I was following by lalalalalalalambda example to put cherrypy behind nginx server, but didn't acomplish anything except nginx 502 bad gataway at my home Debian distro. Here is Nginx settings :

location / {
  include uwsgi_params;
  uwsgi_pass 127.0.0.1:8080;
}

当然有IP而不是套接字,但是通过在网络上跟踪大量示例,努力使它起作用. 我在生产服务器中托管带有静态html的多个域,并尝试切换到python.我希望如果我能解决这个问题,那么我将毫无困难地部署我的python应用程序.

Ofcourse there is IP instead of socket, but tried hard to make it work by following numerious of examples over the net. I'm hosting several domains with static html in production server, and trying to switch to python. I hope if I solve this issue, I will deploy my python app without any pain.

推荐答案

我正在使用uwsgi在nginx后面运行我的Cherrypy网站,并且正在使用以下位置配置设置...

I'm using uwsgi to run my cherrypy websites behind nginx and i'm using the following location config settings...

    location / {
     proxy_set_header    Host                $host;
     proxy_set_header    X-Real-IP           $remote_addr;
     proxy_set_header    X-Forwarded-For     $remote_addr;
     proxy_set_header    X-Originating-IP    $remote_addr;
     proxy_set_header    HTTP_REMOTE_ADDR    $remote_addr;
     proxy_set_header    REMOTE_ADDR         $remote_addr;
     proxy_set_header    CLIENT_IP           $remote_addr;
     proxy_pass http://0.0.0.0:8080/;
    }

希望这会有所帮助!

这篇关于如何将Cherrypy wsgi放在Nginx之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆