mod_wsgi: mod_wsgi.so: cannot open shared object file: No such file or directory

Hi,

i have compiled the latest release today and when im trying to restart the apache server the following is promted to the console:

apache2: Syntax error on line 230 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/httpd.conf: Cannot load modules/mod_wsgi.so into server: /etc/apache2/modules/mod_wsgi.so: cannot open shared object file: No such file or directory

inside my apache2.conf i import my httpd.conf file:

# load  and configure mod_wsgi:

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias /mapproxy /mnt/0a0caead-2478-405e-9924-90617b1656f7/itvs_osm/itvs_wmts/conf/config.py

WSGIApplicationGroup %{GLOBAL}

<Directory /mnt/0a0caead-2478-405e-9924-90617b1656f7/itvs_osm/itvs_wmts/> 
    #Allow from all
    Order Deny,allow
    Require all granted
</Directory>

I installed apacha via https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-18-04

where is my error?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (13 by maintainers)

Most upvoted comments

For whatever reason, your Apache installation isn’t set up such that modules is a sub directory of the Apache root directory. You will need to use:

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

The message is saying it can’t find libpython3.7m.so.1.0 not the mod_wsgi.so file. See:

In short, you are trying to use a Python installation in a non standard location, so you need to tell the build where it is. You can also fudge things by adding:

LoadFile /some/path/libpython3.7m.so.1.0

before the LoadModule line, where /some/path is replaced with the directory where Python library was installed.

You may also need to set WSGIPythonHome directory to be what sys.prefix is set to for Python since not in standard location.

Thank you Graham LoadFile worked fine RHEL

I was able to build MOD_WSGI and restart the Apache successfully. As you mentioned, it took adding LoadFile into the mod_wsgi.load file to get the thing working properly. Copying Python library’s shared object file into /lib, /usr/lib, /usr/local/lib had no effect.