Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_wsgi unable to connect WSGI daemon process

I am using Easy apache 4, mod_wsgi, and Python 3.5. When I called a Django project in the server I got the following error:

(13)Permission denied: mod_wsgi (pid=24223): Unable to connect to WSGI daemon
process 'user123' on '/var/run/wsgi.8442.6.7.sock' as user with uid=3708.
like image 463
nidhin Avatar asked Sep 06 '16 10:09

nidhin


People also ask

What is WSGI daemon process?

Description: Configure a distinct daemon process for running applications. The WSGIDaemonProcess directive can be used to specify that distinct daemon processes should be created to which the running of WSGI applications can be delegated.

Does Apache support WSGI?

mod_wsgi is an Apache module which can host any Python WSGI application, including Django. Django will work with any version of Apache which supports mod_wsgi. The official mod_wsgi documentation is your source for all the details about how to use mod_wsgi.

What is Apache WSGI?

mod_wsgi is an Apache HTTP Server module by Graham Dumpleton that provides a WSGI compliant interface for hosting Python based web applications under Apache. As of version 4.5. 3, mod_wsgi supports Python 2 and 3 (starting from 2.6 and 3.2).

How do I know what version of WSGI I have?

mod_wsgi – Get The Version d/example.com. conf if you use CentOS, RHEL etc., or to /etc/apache2/conf. d/example.com. conf for Debian, Ubuntu etc.


1 Answers

Your Apache installation is likely set up to run with SECURE privileges mode. This means that the Apache child worker process is forked and privileges dropped before handling the request, which in this case is simply trying to proxy the request through to the mod_wsgi daemon process. The consequence of this is that it cannot connect to the socket for the daemon process, as it was setup with ownership to match the original Apache child worker process before privileges were dropped.

This is evident because the error message has uid in the range of a normal user and not the special apache or nobody user.

To fix it, you need to modify the WSGIDaemonProcess directive configuration and add the option:

socket-user=#3708

or:

socket-user=username

where username is replaced with the actual name of the user with uid of 3708.

The addition of this option seems to be required due to recent changes in CPanel configurations for Apache.

like image 196
Graham Dumpleton Avatar answered Sep 20 '22 09:09

Graham Dumpleton