【发布时间】:2018-04-13 12:56:41
【问题描述】:
mod_wsgi 对我来说很新。 我遵循了这个文档 (https://developers.yubico.com/u2fval/Apache_Deployment.html) 的所有步骤,但我发现一个错误。
我的步骤:
- sudo apt-get --assume-yes 更新
- sudo apt-get --assume-yes install build-essential libssl-dev libffi-dev python-dev python-virtualenv
- mkdir -p /etc/yubico/u2fval
- cd /etc/yubico/u2fval
- 虚拟环境 venv
- 来源venv/bin/activate
- sudo pip install --upgrade setuptools pip
- sudo pip install u2fval
- sudo apt-get --assume-yes install apache2-utils libapache2-mod-wsgi
- a2enmod auth_digest
- 在 /etc/yubico/u2fval 创建一个文件 (u2fval.wsgi),其内容为:from u2fval import app as application
- 在 /etc/apache2/conf-available/ 生成一个文件 (u2fval.conf),内容如下:
<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>
- a2enconf u2fval
- 服务 apache2 重新加载
如果我尝试打开 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
谁能帮帮我?我几乎搜索了三个小时,但没有找到解决方案。
【问题讨论】: