Configure Apache to recover from mod_python errors [duplicate]

落爺英雄遲暮 提交于 2019-12-12 01:17:42

问题


I am hosting a Django app on Apache using mod_python. Occasionally, I get some cryptic mod_python errors, usually of the ImportError variety, although not usually referring to the same module. The thing is, these seem to come up for a single forked subprocess, while the others operate fine, even when I force behavior that requires using the module that the problem process has errored on. Once the process encounters the error, it will always just serve the same traceback every time Apache chooses it to handle a request. (This is also a hassle, since my users don't necessarily report the error on the first occurrence, and once the process encounters the error.)

I know more about configuring Django than configuring Apache, but that won't get me anywhere since the request never reaches Django for processing. Ideally, I should solve the root problem, and that might involve my code, project, or machine configuration, but until then, I need help diagnosing and mitigating the problem.

  1. Is there any way to configure the Apache logs to include a subprocess id?
  2. Is there any way to force a subprocess to respawn if it has hit an error?
  3. Are there any known issues relating to this that I should know about?

回答1:


As a workaround, and assuming you are free to install new Apache modules on the server, you might try one of

  • mod_scgi
  • mod_fastcgi
  • mod_wsgi

instead. I use SCGI to connect an nginx frontend webserver to my Django apps, which highlights a major benefit (decoupling from the webserver). All of these packages are available in Debian, probably on RHELx as well.



来源:https://stackoverflow.com/questions/926579/configure-apache-to-recover-from-mod-python-errors

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