1

I checked some similar problems. ex) mod_wsgi unable to connect WSGI daemon process
but it did't work for my problem at least I think.
My error is same that link.

(13)Permission denied: mod_wsgi (pid=6402): Unable to connect to WSGI daemon process 'djangoServer' on '/etc/httpd/run/wsgi.6399.0.1.sock' as user with uid=99.

So I insert socket-user=#99 but it doesn't work. user=#99 group=#99 also failed to resolve.


System is Centos7, python2.7.5, apache2.4.6
And Virtualenv is django app 3.0.3, python 3.6.8

My django.conf is

# WSGISocketPrefix /var/run/wsgi

<VirtualHost *:80>
  DocumentRoot /usr/rest_auth
  ServerName djangoServer

  WSGIDaemonProcess djangoServer user=#99 group=#99 python-path=/usr/myvenv/lib/python3.6/site-packages
  WSGIProcessGroup djangoServer
  WSGIScriptAlias / /usr/rest_auth/rest_auth/wsgi.py

  <Directory "/usr/rest_auth/rest_auth">
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

  Alias /assets/ /usr/rest_auth/static/
  <Directory /usr/rest_auth/static>
    Allow from all
  </Directory>
</VirtualHost>

and wsgi.py is

import os, sys

from django.core.wsgi import get_wsgi_application

path= os.path.abspath(__file__+'/../..')
if path not in sys.path:
    sys.path.append(path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rest_auth.settings")

application = get_wsgi_application()

I tried to solve it via this link. https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGISocketPrefix.html

First move, I used WSGISocketPrefix inside <VirtualHost></VirtualHost>
apache say, WSGISocketPrefix cannot use in VirtualHost.

So I moved WSGISocketPrefix outside VirtualHost.
This way I got more errors than socket-user and I think it's caused by the sqlite version issue.
This is last line errorlog.
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

I think the sqlite version error was caused by using WSGISocketPrefix outside of VirtualHost. I think It ignore my envirament.


If it was a problem with chmod, can you tell which directory should be changed? I already tried some directories.


Thanks to read my problem and give a advice.
This is the first post on stack overflow and I think the writing technique will make a mistake. (I used Google Translator ...) Please understand.

SOULKIM
  • 11
  • 1

1 Answers1

0

Certain things to start with:

  1. Never create the mysite data into your $HOME.
  2. Always use directory other than $HOME.
  3. /var/www/html/mysite should have apache/apache owner and group. Ideally this could make it working with correct vhosts conf files
  4. After doing all this apache still do not have read/compile permissions on wsgi.py.
  5. django is available in $HOME but not under /var/ww/html/mysite. Then it's an env issue.
farshad
  • 764
  • 10
  • 25
m-uday
  • 1
  • 2