0

Please assist. I have a Django site that i'm trying to configure to run in apache using mod_wsgi. I have setup my virtualhost as follows:

<virtualhost *:80>

        ServerName mysite.com
        ServerAlias mysite.com

        Alias /static/my_site/ /opt/mysitepath/mysite/static/my_site/
        WSGIDaemonProcess my_site python-home=/usr/local/virtualenvironment python-path=/opt/mysitepath processes=2 threads=1
        WSGIProcessGroup my_site
        WSGIScriptAlias / /opt/mysitepath/mysite/wsgi.py process-group=my_site
        <Directory /opt/mysitepath/mysite/static/my_site>
                Require all granted
        </Directory>

        <Directory /opt/mysitepath/mysite>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>
        LogLevel info
        ErrorLog logs/mysite.com_log
</virtualhost>

The obvious issue i'm seeing when I startup apache is the following:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message [Fri Apr 20 04:42:27.900968 2018] [auth_digest:notice] [pid 1206] AH01757: generating secret for digest authentication ... [Fri Apr 20 04:42:27.901742 2018] [lbmethod_heartbeat:notice] [pid 1206] AH02282: No slotmem from mod_heartmonitor [Fri Apr 20 04:42:27.997621 2018] [:warn] [pid 1206] mod_wsgi: Compiled for Python/3.4.0. [Fri Apr 20 04:42:27.997647 2018] [:warn] [pid 1206] mod_wsgi: Runtime using Python/3.4.5. [Fri Apr 20 04:42:27.997681 2018] [:alert] [pid 1206] (2)No such file or directory: mod_wsgi (pid=1206): Couldn't bind unix domain socket '/var/run/apache2/wsgi.1206.0.1.sock'. [Fri Apr 20 04:42:28.005204 2018] [mpm_prefork:notice] [pid 1206] AH00163: Apache/2.4.6 (CentOS) PHP/5.6.31 SVN/1.7.14 mod_wsgi/3.4 Python/3.4.5 configured -- resuming normal operations

And when I navigate to the website via the browser I get

503 Service unavailable

Any idea why apache can't bind on the socket where mod_wsgi should be listening? How can I get my site to load correctly?

Thanks in advance!

  • Some formatting would help. Also your log file clearly says that the socket doesn't exists. Check that you have correct path. – AlexD Apr 20 '18 at 6:43
0

Seems I had to add an entry in my virtualhost

WSGISocketPrefix /var/run/wsgi

My virtual host now looks like the following:

WSGISocketPrefix /var/run/wsgi
<virtualhost *:80>

        ServerName mysite.com
        ServerAlias mysite.com

        Alias /static/my_site/ /opt/mysitepath/mysite/static/my_site/
        WSGIDaemonProcess my_site python-home=/usr/local/virtualenvironment python-path=/opt/mysitepath processes=2 threads=1
        WSGIProcessGroup my_site
        WSGIScriptAlias / /opt/mysitepath/mysite/wsgi.py process-group=my_site
        <Directory /opt/mysitepath/mysite/static/my_site>
                Require all granted
        </Directory>

        <Directory /opt/mysitepath/mysite>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>
        LogLevel info
        ErrorLog logs/mysite.com_log
</virtualhost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.