我正在使用CentOS 7,Apache 2.4和Python 3.7波段mod_wsgi 4.6.5。我正在尝试用Apache安装mod_wsgi。我创建了文件/etc/httpd/conf.modules.d/10-wsgi.conf,其中包含的内容
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
但是当我尝试加载Apache时,它会因为错误而死掉
[myuser@server mod_wsgi-4.6.5]$ sudo apachectl configtest
httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/10-wsgi.conf: Cannot load /usr/lib64/httpd/modules/mod_wsgi.so into server: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
[myuser@server mod_wsgi-4.6.5]$ cat /etc/httpd/conf.modules.d/10-wsgi.conf
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/10-wsgi.conf: Cannot load /usr/lib64/httpd/modules/mod_wsgi.so into server: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
我已验证此文件存在于我的文件系统中
[myuser@server mod_wsgi-4.6.5]$ echo $LD_LIBRARY_PATH
/usr/local/lib
[myuser@server mod_wsgi-4.6.5]$ ls -al /usr/local/lib/libpython3.7m.so.1.0
-r-xr-xr-x 1 root root 13683680 Feb 27 18:01 /usr/local/lib/libpython3.7m.so.1.0
我不知道还有什么要检查以说服我的系统一切都在那里。任何帮助表示赞赏, -
是否启用了selinux?检查selinux是否阻止访问:
grep "httpd" /var/log/audit/audit.log
我从来没有偶然发现这个问题的根本原因,但是当我添加这一行时
LoadFile /usr/local/lib/libpython3.7m.so.1.0
在我的/etc/httpd/conf.modules.d/10-wsgi.conf文件的顶部并重新启动我的服务器,一切正常。