我需要使用apache或nginx来托管服务器吗?

2024-03-29 09:10:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要使用NginX还是不用NginX就可以托管它?在

我正在开发我的第一个django项目,现在我可以使用以下命令运行应用程序项目:

./manage.py run_gunicorn -c config/gunicorn

然后我可以通过以下方式查看:

^{pr2}$

我现在想尝试托管它,以便其他电脑可以访问这个。在


Tags: 项目djangorunpy命令config应用程序manage
3条回答

当然不是。您可以使用lighttpd或任何其他支持WSGI、SCGI、FastCGI或AJP的web服务器。您可以参考这个python documentationdjango documentation,关于stackoverflow的这两个问题:Cleanest & Fastest server setup for DjangoDifferences and uses between WSGI, CGI, FastCGI, and mod_python in regards to Python?可能也有帮助。在

Gunicorn is wsgi http server. It is best to use Gunicorn behind HTTP proxy server. We strongly advise you to use nginx.

@http://gunicorn.org/#deployment

Although there are many HTTP proxies available, we strongly advise that you use Nginx. If you choose another proxy server you need to make sure that it buffers slow clients when you use default Gunicorn workers. Without this buffering Gunicorn will be easily susceptible to denial-of-service attacks.

@http://docs.gunicorn.org/en/latest/deploy.html

您不需要前端代理;您可以将gunicorn这样的独立web服务器直接放到生产环境中。但是有各种各样的原因,你可能want to use a frontend webserver anyway。在

相关问题 更多 >