How to put Cherrypy wsgi behind Nginx?

ⅰ亾dé卋堺 提交于 2019-12-24 09:28:18

问题


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;
}

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.


回答1:


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/;
    }

Hope this helps!



来源:https://stackoverflow.com/questions/23359095/how-to-put-cherrypy-wsgi-behind-nginx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!