S
S
sha2562020-01-26 10:38:36
Python
sha256, 2020-01-26 10:38:36

How to set up mod_wsgi with apache when running multiple VirtualHost?

Friends, hello everyone!
Tell me where the error is in the configuration of the wsgi.conf file, I'm trying to publish the second web service, but only the one that is written first works, the second one after restarting the server is perceived as a directory and writes no access.

#Configure mod_wsgi file apache
<VirtualHost *:80>

    ServerName pymain

    WSGIDaemonProcess pybsk processes=1 threads=5 display-name='pymain-service' restart-interval=86400
    WSGIScriptAlias /GetMain /var/www/python/pymain.py
    
    # WSGICallableObject 'application'
    LogLevel info
    DocumentRoot /var/www/python/

    <Directory /var/www/python/>
        WSGIProcessGroup pymain
        WSGIApplicationGroup %{GLOBAL}
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </Directory>

    <IfDefine MOD_WSGI_LOAD_PYTHON_DYLIB>
        LoadFile ''
    </IfDefine>
    
    WSGIMapHEADToGET Auto

</VirtualHost>

<VirtualHost *:80>

    ServerName pk

    WSGIDaemonProcess pk processes=1 threads=1 display-name='pk-service' restart-interval=86400
    WSGIScriptAlias /pk /var/www/python/pk/pkmain.py
    
    # WSGICallableObject 'application'
    LogLevel info
    DocumentRoot /var/www/python/pk/

    <Directory /var/www/python/pk/>
        WSGIProcessGroup pk
        WSGIApplicationGroup %{GLOBAL}
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </Directory>

    <IfDefine MOD_WSGI_LOAD_PYTHON_DYLIB>
        LoadFile ''
    </IfDefine>
    WSGIMapHEADToGET Auto

</VirtualHost>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2020-01-26
@sha256

1) is there something in the logs?
2) does apache have permissions to /var/www/python/pk ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question