1

I have a problem with Apache/wsgi on Ubuntu. I'm trying to serve a django site. I have already read all same issues on SO and other websites but i really can't fix it.

I got the same problem as other member. After 2 - 3 minutes the request ends with a 500 error and the log tell me : Script timed out before returning headers - wsgi.py.

Rights are ok, Apache 2.4.7, libapache2-mod-wsgi 4ubuntu2.1.14.04.2.

List of mods enabled :

  • access_compat.load
  • alias.conf
  • alias.load
  • auth_basic.load
  • authn_core.load
  • authn_file.load
  • authz_core.load
  • authz_groupfile.load
  • authz_host.load
  • authz_user.load
  • autoindex.conf
  • autoindex.load
  • cgi.load
  • deflate.conf
  • deflate.load
  • dir.conf
  • dir.load
  • env.load
  • filter.load
  • mime.conf
  • mime.load
  • mpm_prefork.conf
  • mpm_prefork.load
  • negotiation.conf
  • negotiation.load
  • php5.conf
  • php5.load
  • reqtimeout.conf
  • reqtimeout.load
  • rewrite.load
  • setenvif.conf
  • setenvif.load
  • status.conf
  • status.load
  • wsgi.conf
  • wsgi.load

And This is my virtual host

<VirtualHost *:80>
    ServerAdmin info@rescuecode.fr
    ServerName fiches.rescuecode.fr

    DocumentRoot /home/repos/git/rescuecode-fiches

    WSGIDaemonProcess rescuecode-fiches python-path=/home/repos/git/rescuecode-fiches:/home/virtualenvs/rescuecode-fiches/lib/python2.7/site-packages processes=4 threads=25
    WSGIProcessGroup rescuecode-fiches
    WSGIScriptAlias / /home/repos/git/rescuecode-fiches/project/wsgi.py
    WSGIApplicationGroup %{GLOBAL}

    Alias /static /home/repos/git/rescuecode-fiches/project/static/

    <Directory /home/repos/git/rescuecode-fiches/project/static>
            Require all granted
    </Directory>

    Alias /site_media /home/repos/git/rescuecode-fiches/project/site_media/

    <Directory /home/repos/git/rescuecode-fiches/project/site_media>
            Require all granted
    </Directory>

    <Directory /home/repos/git/rescuecode-fiches/project>
            <Files wsgi.py>
                    Require all granted
            </Files>
    </Directory>

    Loglevel warn
    ErrorLog /var/log/apache2/fiches.rescuecode.fr-error.log
    CustomLog /var/log/apache2/fiches.rescuecode.fr-access.log combined
    ServerSignature Off

Can someone tell me where i'm wrong ?

Thank you !

  • 1
    What does the main (not the VirtualHost) Apache log file say? Does it indicate the process crashed? Up the LogLevel to info for whole of Apache and VirtualHost and you might get more information. – Graham Dumpleton Jul 22 '15 at 08:31
  • mod_wsgi (pid=10409): Failure to configure the daemon process correctly and process left in unspecified state. Restarting daemon process after delay. – Thomas Montagnoni Jul 22 '15 at 08:33
  • I go check if i find something on the net ! Thank you already for this :) – Thomas Montagnoni Jul 22 '15 at 08:34
  • I guess this is a directory problem. i have /home/repos and he search for /home/mercurial if i understand : No such file or directory: mod_wsgi Unable to change working directory '/home/mercurial' – Thomas Montagnoni Jul 22 '15 at 08:37

1 Answers1

1

Thank you Graham Dumpleton !!

I added this to the Vhost :

WSGIDaemonProcess home=/home/repos

All work fine now :) Was a directory problem !

  • Older versions of mod_wsgi would blindly ignore the lack of a home directory for the user the daemon process was explicitly set to and fallback to using '/'. This concerned some from a security standpoint and so the behaviour was changed to force a home directory to be specified explicitly if a valid directory wasn't against the account in the system password file. – Graham Dumpleton Jul 22 '15 at 11:41