遇到问题
Apache部署django-vue-lyadmin时,登录系统报错Authentication credentials were not provided
code:4001
msg:Authentication credentials were not provided
问题原因
使用 mod_wsgi 部署到 Apache默认情况下不会将授权标头传递给 WSGI 应用程序。部署到 Apache 并使用任何基于非会话的身份验证则需要显式配置 mod_wsgi 以将所需的标头传递给应用程序
可以通过 WSGIPassAuthorization 设置为 'On' 来完成。即:WSGIPassAuthorization On
解决方法
在apache的配置文件中添加一下内容:
WSGIPassAuthorization On
举例
...
WSGIScriptAlias / /www/wwwroot/django-vue-lyadmin/backend/application/wsgi.py
WSGIPAssAuthorization On
<Directory /www/wwwroot/django-vue-lyadmin/backend/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
...