[Fixed]-Mod_wsgi apache2 loading failure

1👍

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.

👤ifti

Leave a comment