首页 > 解决方案 > Django 在 HTTPS 上显示 500 内部服务器错误

问题描述

error.log在 apache2 目录中收到以下错误: Segmentation fault (11), possible coredump in /etc/apache2.

我的配置中有以下配置example-instance.conf

 ErrorDocument 404 "/error-pages/404.html"
 ErrorDocument 500 "/error-pages/500.html"
 ErrorDocument 403 "/error-pages/403.html"

 # Change the following three lines for your server

 ServerName example.app
 SetEnv HTTP_HOST "example.app"
 ServerAdmin admin@example.app

 SetEnv LC_TIME "en_GB.UTF-8"
 SetEnv LANG "en_US.UTF-8"

 SSLEngine on

 SSLCertificateFile "path/to/certificate"
 SSLCertificateChainFile "path/to/certificate"
 SSLCertificateKeyFile "path/to/private_key"

 WSGIScriptAlias /app "path/to/wsgi_prod.py"

 # Comment next 2 lines if using older Apache than v2.4
 WSGIApplicationGroup %{GLOBAL}
 WSGIDaemonProcess instance1_wsgi python-path="__PATH_TO_ENV_SITE-PACKAGES_FOLDER__"
 WSGIProcessGroup instance1_wsgi

 # Comment 'Require all granted' for older Apache than v2.4

 <Location "/">
   Require all granted
   Options FollowSymLinks
 </Location>

 Alias /static/ "path/to/static/"
 Alias /app/static/ "path/to/static/"
 <Directory "path/to/static/">
   Require all granted
   Options -Indexes
 </Directory>

 Alias /data/ "path/to/data/"
 <Directory "path/to/data/">
   Require all granted
   Options -Indexes
 </Directory>

 ErrorLog ${APACHE_LOG_DIR}/example-instance-error.log
 LogLevel warn
 CustomLog ${APACHE_LOG_DIR}/example-instance-access.log combined

该网站http在配置它时运行得非常好https,我正在进入500 Internal Server Error我的 Django 应用程序所在的“/app”子目录。该网站的登录页面非常好,这表明它https正在工作。

标签: djangosslhttpsapache2mod-wsgi

解决方案


我有同样的问题:/ 现在唯一的选择是关闭 mod_ssl 并返回配置文件中的端口 80。

奇怪的是我在 settings.py 中有 Debug = True 但是当应用程序崩溃时我只收到来自 apache 的错误 500 页面。


推荐阅读