Centos – 503 errors on Apache+Mod_wsgi+Django

apache-2.2centosdjangomod-wsgipython

I'm new to Python and trying to setup Django on my VPS that is running CentoOS 6.5. My Apache version is 2.2.15. Python is running on version 2.7.

  • I created a virtualenv under /var/www/html/djangotest
  • I installed Django under the new virtualenv
  • I installed mod_wsgi, loaded the module, and created the following entry in my httpd.conf:
<VirtualHost *:80>
        WSGIDaemonProcess sampleapp python-path=/var/www/html/djangotest:/var/www/html/djangotest/env/lib/python2.7/site-packages
        WSGIProcessGroup sampleapp
        WSGIScriptAlias / /var/www/html/djangotest/sampleapp/wsgi.py
        DocumentRoot /var/www/html/djangotest/sampleapp
        ServerName django.domain.com
        ServerAlias www.django.domain.com
        ErrorLog /var/www/html/djangotest/error_logs
        <Directory /var/www/html/jdlferreira.com/djangotest>
            AllowOverride All
            Allow from all
        </Directory>
</VirtualHost>

Restarted apache with success, but visiting the url is returning me 503 Service Temporarily Unavailable.

The guide that I essentially followed is https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps (adjustments were made for CentOS)

Where did I go wrong?

Best Answer

To anyone else having this issue, read the following: https://code.google.com/p/modwsgi/wiki/ConfigurationIssues

I resolved my issues by appending the following in my httpd.conf:

WSGISocketPrefix /var/run/wsgi

Related Topic