user6140865
user6140865

Reputation:

mod_wsgi apache2 loading failure

I've set this up using a multitude of documentation and repeatedly get the same result. This particular one below is following https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/#daemon-mode exactly as it says. I need help!

[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'.

Upvotes: 0

Views: 1154

Answers (1)

ifti
ifti

Reputation: 669

If You are trying to deploy Django web on EB with a single EC2 instance and want to configure SSL on that single EB instance instead of doing at ELB.

Step-1 Login to EC2 and do sudo yum install mod24_ssl.

Step-2 sudo vi /etc/httpd/conf.d/ssl.conf

Step-3 Paste below config

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

Step-4
CERTIFICATE.crt > "/etc/pki/tls/certs/server.crt"

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

Step-5 Restart server

Try Https on your site, should be working fine.

Upvotes: 1

Related Questions