简体   繁体   English

与Django和Gunicorn一起使用时,如何为所有错误处理配置nginx?

[英]how to configure nginx for all error handling when using with Django and Gunicorn?

If I am using Nginx, Django, and Gunicorn, how to use Nginx to handle all errors with static contents, eg 404, etc? 如果我使用的是Nginx,Django和Gunicorn,如何使用Nginx处理所有带有静态内容(例如404等)的错误?

Reason) If for some reasons, Django or Gunicorn crashes (and either of them won't come back up), normally error content handled by Django cannot be served anymore, how to configure nginx to handle the error properly? 原因)如果由于某些原因Django或Gunicorn崩溃(并且它们中的任何一个都不会恢复),通常无法再提供Django处理的错误内容,如何配置nginx来正确处理该错误?

Thank you. 谢谢。

Check this blog: 查看此博客:

Setting up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL 使用Nginx,Gunicorn,virtualenv,supervisor和PostgreSQL设置Django

Has great content for setting up Django on production using gunicorn & nginx . 对于使用gunicorn和nginx在生产环境中设置Django具有丰富的内容。 Also covers setting up static and media files. 还介绍了设置静态文件和媒体文件。

Might help :) 可能有帮助 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM