【问题标题】:Apache server mod_wsgi in Redhat gives 500 errorRedhat 中的 Apache 服务器 mod_wsgi 给出 500 错误
【发布时间】:2019-12-03 07:22:25
【问题描述】:

我有一个 python 应用程序,它将处理来自 RedHat 上的 apache 网络服务器提供的 html 表单的 HTTP 响应和请求。我的问题是我似乎找不到500 Interval Server Error 的原因我已经两次和三次检查了所有文件的权限,但没有运气。我曾尝试更改 default.conf 文件中的内容,但我真的不知道我应该在那里搞砸什么。所有这一切中最糟糕的部分是,直到几天前,我正在执行所有这些操作的虚拟机随机死在我身上时,我才让这一切正常运行。现在我不记得我做了什么才能让它正常工作。

这是我的 VirtualHost conf 文件:

<VirtualHost 172.22.2.3:80>
    ServerName www.mapzest.com
    DocumentRoot /var/www/templates 
    Redirect permanent / https://www.mapzest.com
</VirtualHost>

<VirtualHost 172.22.2.3:443>

    ServerName www.mapzest.com

    DocumentRoot /var/www/templates

    Alias /static/ /var/www/static

    SSLEngine On
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

    <Directory /var/www/templates>
        Require all granted
        AllowOverride All
    </Directory>

    WSGIScriptAlias / /var/www/python/app.py

    WSGIDaemonProcess mapzest.com python-path=/usr:/var/www/python
    WSGIProcessGroup mapzest.com

    <Directory /var/www/python>
        Require all granted
    </Directory>

    <Directory /var/www/static>
        Require all granted
    </Directory>

</VirtualHost>

还有我的 /etc/httpd/logs/error_log 输出:

[Tue Dec 03 02:02:03.073297 2019] [core:notice] [pid 52933:tid 140480814379328] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Tue Dec 03 02:02:03.074106 2019] [suexec:notice] [pid 52933:tid 140480814379328] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Dec 03 02:02:03.075278 2019] [ssl:warn] [pid 52933:tid 140480814379328] AH01909: www.mapzest.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Dec 03 02:02:03.091284 2019] [ssl:warn] [pid 52933:tid 140480814379328] AH01909: www.mapzest.com:443:0 server certificate does NOT include an ID which matches the server name
[Tue Dec 03 02:02:03.091431 2019] [lbmethod_heartbeat:notice] [pid 52933:tid 140480814379328] AH02282: No slotmem from mod_heartmonitor
[Tue Dec 03 02:02:03.094860 2019] [mpm_event:notice] [pid 52933:tid 140480814379328] AH00489: Apache/2.4.41 (Fedora) OpenSSL/1.1.1d mod_wsgi/4.6.6 Python/3.7 configured -- resuming normal operations
[Tue Dec 03 02:02:03.094880 2019] [core:notice] [pid 52933:tid 140480814379328] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

【问题讨论】:

  • 这可能与“服务器证书不包含与服务器名称匹配的ID”有关

标签: python apache redhat mod-wsgi


【解决方案1】:

对于任何可能发现此问题的人,我最终遇到的问题是 SELinux 在我的 Python 脚本中阻止了我的 Postgresql 连接。我必须将 /etc/httpd/conf/httpd.conf 文件的日志记录级别编辑为 debug,然后才能看到根本错误是什么。

【讨论】:

    猜你喜欢
    • 2017-07-15
    • 2017-09-05
    • 2011-08-08
    • 1970-01-01
    • 1970-01-01
    • 2015-06-09
    • 2012-08-19
    • 1970-01-01
    • 2014-10-02
    相关资源
    最近更新 更多