mod_wsgi apache2加载失败

时间:2016-10-09 18:56:26

标签: django apache ubuntu mod-wsgi

我已经使用大量文档进行了设置,并重复获得相同的结果。下面这个特别的一个跟{4}完全一样。我需要帮助!

[Sun Oct 09 14:52:09.208810 2016] [wsgi:warn] [pid 53237] mod_wsgi: Compiled for Python/3.5.1+.
[Sun Oct 09 14:52:09.208844 2016] [wsgi:warn] [pid 53237] mod_wsgi: Runtime using Python/3.5.2.
[Sun Oct 09 14:52:09.210835 2016] [mpm_prefork:notice] [pid 53237] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations
[Sun Oct 09 14:52:09.210866 2016] [core:notice] [pid 53237] AH00094: Command line: '/usr/sbin/apache2'
[Sun Oct 09 14:52:09.245977 2016] [wsgi:error] [pid 53240] mod_wsgi (pid=53240): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Sun Oct 09 14:52:09.246021 2016] [wsgi:error] [pid 53240] mod_wsgi (pid=53240): Call to 'site.addsitedir()' failed for '/home/addohm/projects/rtservice/projectenv/lib/python2.7/site-packages'.

1 个答案:

答案 0 :(得分:1)

如果您尝试在具有单个EC2实例的EB上部署Django Web,并且想要在该单个EB实例上配置SSL,而不是在ELB上进行。

步骤1登录到EC2并执行sudo yum install mod24_ssl

步骤2 sudo vi /etc/httpd/conf.d/ssl.conf

第3步粘贴到配置

LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/venv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On
Listen 443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/pki/tls/certs/server.crt"
SSLCertificateKeyFile "/etc/pki/tls/certs/server.key"

Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static>
 Order allow,deny
 Allow from all
</Directory>

WSGIScriptAlias / /opt/python/current/app/<yoursite>/wsgi.py

<Directory /opt/python/current/app>
 Require all granted
</Directory>

WSGIDaemonProcess wsgi-ssl processes=1 threads=15 display-name=%{GROUP} \
 python-home=/opt/python/run/venv/ \
 python-path=/opt/python/current/app user=wsgi group=wsgi \
 home=/opt/python/current/app
WSGIProcessGroup wsgi-ssl

第4步
CERTIFICATE.crt>“ /etc/pki/tls/certs/server.crt”

PRIVATE KEY.crt>“ /etc/pki/tls/certs/server.key”

步骤5重新启动服务器

在您的网站上尝试Https,应该可以正常工作。