0

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?

3 Answers 3

3

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

0

I put it before the virtualhost

LoadModule wsgi_module /usr/lib64/apache2/modules/mod_wsgi.so <VirtualHost 69.16.201.27:443> ServerName blue.domain.com .... 
1
  • 1
    This is what I have explained in my answer, placing it before the WSGIPythonHome line, which is before the <VirtualHost> line. Commented Jul 14, 2019 at 21:07
0

Installing apt package libapache2-mod-wsgi-py3 helped me

1
  • 1
    The question clearly states that it is a CentOS 7 system, so Debian/Ubuntu packages will not help. Commented Sep 10, 2020 at 23:39

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.