Apache/httpd error: Invalid command 'WSGIPythonHome'

5,378

EUREKA!

I was able to fix the problem by adding the following before the httpd.conf additions I have displayed in the question (so, just before WSGIPythonHome /var/www/web-virt-env):

LoadModule wsgi_module /opt/rh/httpd24/root/usr/lib64/httpd/modules/mod_rh-python36-wsgi.so

Share:
5,378

Related videos on Youtube

Josh
Author by

Josh

Passionate about programming, it's my favorite thing to do, to just be always solving something. Python, Django, SQL, .NET (C#), Apache, Linux: I wear several “hats.”

Updated on September 18, 2022

Comments

  • Josh
    Josh over 1 year

    ISSUE:

    My Apache/httpd server will not launch. journalctl -xe reveals:

    Feb 27 01:50:12 localhost.localdomain httpd[4398]: AH00526: Syntax error on line 355 of /etc/httpd/conf/httpd.conf:
    Feb 27 01:50:12 localhost.localdomain httpd[4398]: Invalid command 'WSGIPythonHome', perhaps misspelled or defined by a module not included in the server configuration
    Feb 27 01:50:12 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
    Feb 27 01:50:13 localhost.localdomain kill[4399]: kill: cannot find process ""
    Feb 27 01:50:13 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
    Feb 27 01:50:13 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
    

    httpd -S reveals:

    AH00526: Syntax error on line 355 of /etc/httpd/conf/httpd.conf:
    Invalid command 'WSGIPythonHome', perhaps misspelled or defined by a module not included in the server configuration
    

    SPECS

    • CentOS 7 (This is a virtual machine running on an Ubuntu 18.10 host)
    • rh-python36 installed
    • rh-python36-mod_wsgi-4.5.18-1.el7.x86_64 installed
    • python virtual env created at /var/www/web-virt-env

    httpd.conf:

    WSGIPythonHome /var/www/web-virt-env
    WSGIPythonPath /var/www/html/somewebsite
    
    <VirtualHost *:80>
    
        ServerName awebsite.com
        DocumentRoot /var/www/html/somewebsite
        WSGIDaemonProcess somewebsite1 python-home=/var/www/web-virt-env
        WSGIProcessGroup somewebsite1
        WSGIScriptAlias / /var/www/html/somewebsite/somewebsite/wsgi.py
    
        <Directory /var/www/html/somewebsite/somewebsite>
                Require all granted
        </Directory>
    
        Alias /static /var/www/html/somewebsite/static
        <Directory /var/www/html/somewebsite/static>
                Require all granted
        </Directory>
    
    </VirtualHost>
    

    Expected output:

    I expected that the site would launch when I executed systemctl start httpd

    I am suspicious that rh-python36-mod_wsgi-4.5.18-1.el7.x86_64 isn't being "found," but I'm not sure how this is working behind the scenes.

    What can I do to work around this? Or at least, which steps should I take next to trouble shoot this?

  • Josh
    Josh almost 5 years
    This is what I have explained in my answer, placing it before the WSGIPythonHome line, which is before the <VirtualHost> line.
  • Andreas Rogge
    Andreas Rogge over 3 years
    The question clearly states that it is a CentOS 7 system, so Debian/Ubuntu packages will not help.