A
A
anti18692012-07-02 15:18:37
linux
anti1869, 2012-07-02 15:18:37

Getting 503 Service Temporarily Unavailable when I try to run mod_wsgi in daemon mode?

Colleagues, I'm not a very big Apache expert and I can not overcome the following problem:
I want to configure mod_wsgi in Daemon mode on the virtual host in order to monitor changes to the Python application source code. When accessing the server, I get an error 503 Service Temporarily Unavailable
In the log:
(13)Permission denied: mod_wsgi (pid=9400): Unable to connect to WSGI daemon process 'blabla.com' on '/var/run/wsgi.5619.0.1 .sock' after multiple attempts.
Here is the virtual machine config:

<VirtualHost *:80><br>
  DocumentRoot /home/anti1869/blabla/http<br>
  CustomLog /var/log/apache2/anti1869/blabla/access.log combined<br>
  ErrorLog /var/log/apache2/anti1869/blabla/error.log<br>
  <IfModule peruser.c><br>
    ServerEnvironment anti1869 anti1869<br>
    Processor anti1869 anti1869<br>
  </IfModule><br>
#	<IfModule mod_suexec.c><br>
#		SuexecUserGroup anti1869 anti1869<br>
#	</IfModule><br>
#	<IfModule mod_suexec><br>
#		SuexecUserGroup anti1869 anti1869<br>
#	</IfModule><br>
  ServerName blabla.com<br>
  ServerAlias www.blabla.com<br>
  Alias /.awstats/icon /usr/share/awstats/wwwroot/icon<br><br>
  WSGIDaemonProcess blabla.com user=anti1869 group=anti1869 processes=2 threads=15 display-name=%{GROUP}<br>
  WSGIProcessGroup blabla.com<br>
</VirtualHost><br>

I tried to specify different directories in the directive:
WSGISocketPrefix /var/run/wsgi
but the same error happens all the time. I
tried /tmp/wsgi and create my own directory with permissions 777 - the same garbage
. Such a file is created, but Apache cannot reach it
srwx------ 1 apache root 0 Jul 2 15:57 wsgi.5619.0.1.sock Tell me
what else to try? Thanks

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alz, 2012-07-02
@alz

Why don't you have the WSGIScriptAlias ​​directive?
Here is a piece of my working config

    WSGIDaemonProcess   pb      user=django python-path=/home/django/pb

    WSGIScriptAlias     /       /home/django/pb/pb/wsgi.py
    WSGIProcessGroup    pb
    
    Alias       /static/        /home/django/pb/static/

    <Directory /home/django/pb/pb>
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>

        AuthName                NTAuth
        AuthType                NTLM
        NTLMAuth                on
        NTLMBasicAuth           on
        NTLMAuthHelper          "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
        NTLMBasicAuthoritative  on
        Require                 valid-user
        Satisfy                 all
    </Directory>

A
anti1869, 2012-07-02
@anti1869

alz, there is no WSGIScriptAlias, because so far my application is mapped like this through .htaccess:

<Files code.py>
    SetHandler wsgi-script
    Options ExecCGI FollowSymLinks
</Files>

I have not yet figured out whether this is good or bad - I just copied from the web.py framework tutorial.
It looks like the problem is that Peruser MPM is used on my server.
This
ServerEnvironment anti1869 anti1869 directive
starts processes from under my user, and Apache creates a socket file for the apache:root user.
Accordingly, they do not match and mod_wsgi cannot handle it.
I've tried putting ServerEnvironment apache root
503 gone, but a potential permissions hemorrhage prevents this from being called a solution.
ServerEnvironment anti1869 anti1869

A
anti1869, 2012-07-03
@anti1869

In general, everything is correct. In order for mod_wsgi to work in Daemon Mode, Apache must be compiled with either prefork MPM or worker MPM. My server had peruser MPM - mod_wsgi is currently not compatible with it. I had to rebuild apache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question