mod_wsgi对我来说是很新的。我遵循了这个文档(Deployment.html)的所有步骤,但是我得到了一个错误。
我的脚步:
<IfModule mod_wsgi.c>
WSGIDaemonProcess u2fval python-home=/etc/yubico/u2fval/venv
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /wsapi/u2fval /etc/yubico/u2fval/u2fval.wsgi process-group=u2fval
<Directory /etc/yubico/u2fval>
Options None
AllowOverride None
AuthType Digest
AuthName "u2fval"
AuthUserFile /etc/yubico/u2fval/clients.htdigest
Require valid-user
</Directory>
</IfModule>如果我试图打开http://localhost/wsapi/u2fval/,就会得到以下错误:
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。
在/var/log/apache2/error.log中:
[Wed Mar 28 09:34:22.915421 2018] [mpm_prefork:notice] [pid 31834] AH00163: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Wed Mar 28 09:34:22.915487 2018] [core:notice] [pid 31834] AH00094: Command line: '/usr/sbin/apache2'
[Wed Mar 28 09:34:39.052131 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] mod_wsgi (pid=31916): Target WSGI script '/etc/yubico/u2fval/u2fval.wsgi' cannot be loaded as Python module.
[Wed Mar 28 09:34:39.052197 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] mod_wsgi (pid=31916): Exception occurred processing WSGI script '/etc/yubico/u2fval/u2fval.wsgi'.
[Wed Mar 28 09:34:39.052514 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] Traceback (most recent call last):
[Wed Mar 28 09:34:39.052563 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] File "/etc/yubico/u2fval/u2fval.wsgi", line 1, in <module>
[Wed Mar 28 09:34:39.052658 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] from u2fval import app as application
[Wed Mar 28 09:34:39.052687 2018] [:error] [pid 31916] [remote 192.168.198.13:49242] ImportError: No module named u2fval有谁可以帮我?我几乎找了三个小时,没有找到解决办法。
发布于 2018-04-13 23:31:12
如果应用程序代码在/etc/yubico/u2fval中,那么添加:
python-path=/etc/yubico/u2fval到WSGIDaemonProcess指令。
您需要告诉它应用程序代码在哪里,因为它不会自动查看WSGI脚本文件所在的目录。
顺便说一句,错误消息中的路径不符合您的配置所显示的WSGI脚本文件的位置。无论如何,根据需要调整这条路。
https://stackoverflow.com/questions/49817595
复制相似问题