简体   繁体   中英

Apache 2.2/Redhat 2.6 with mod_wsgi

I'm having trouble configuring mod_wsgi with my current set up.

Redhat 2.6.32

Installations setup as non-root user:

  • Apache 2.2 (attempted to get 2.4, but without access to yum the dependencies were too much)
  • Python 3.6

I seem to have successfully installed mod_wsgi into /apache/modules.

Problems:

  • The apache directory structure is not what most tutorials indicate, its
    DocumentRoot is in /apache/htdocs, not /var/www/ or /sites-enabled/ or /sites/available/
  • I tried putting: LoadModule wsgi_module modules/mod_wsgi.so in httpd.conf but I am returned: $HOME/apache/modules/mod_wsgi.so into server: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

Can anyone explain how I can use mod_wsgi with my current setup?

The problem is likely because you self compiled mod_wsgi and the Python installation you used is in a non standard location. In this case you need to se LD_RUN_PATH environment variable when running make for mod_wsgi, with it set to the directory the Python library is in. This way knowledge of where the Python library is is embedded in mod_wsgi. This issue is described in the mod_wsgi documentation:

If you can't rebuild mod_wsgi for some reason, you can also force load the Python shared library into Apache by using:

LoadFile /some/path/lib/libpython3.6m.so.1.0

This should be place just before the LoadModule line for mod_wsgi.

Your libpython3.6m.so.1.0 is not in any of apache's library paths.

You can symlink it to one of the lib directories in apache's library path, or you can add the directory where your libpython3.6m.so.1.0 resides to apache's library path.

Check this question out for help with apache paths: https://serverfault.com/questions/151328/setting-apache2-path-environment-variable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM