我需要在我的小型 Python 应用程序(只有一个脚本)中从 nginx + uWSGI 获取身份验证数据。身份验证必须在 Web 服务器端(例如 nginx,nginx.conf 中的基本身份验证)而不是在 Python 应用程序中实现,这很重要!所以,没有中间件或类似的东西会有所帮助......
我想 uWSGI 必须通过它的 API 或 smth 将此数据发送到我的 Python 应用程序。
如何在我的 Python 脚本中获取这些数据?我需要像
$_SERVER['PHP_AUTH_USER']
在 php.ini 中。
uWSGI 配置:
[uwsgi]
socket = /tmp/uwsgi.sock
processes = 4
master = true
module = myapp
harakiri = 30
cache = false
daemonize = /var/log/uwsgi.log
nginx配置:
server {
listen 8080;
server_name _;
location / {
include uwsgi_params;
uwsgi_pass unix:///tmp/uwsgi.sock;
uwsgi_cache off;
}
}
谢谢!