我正在使用aiohttp开发一个Web应用程序,其中使用aiohttp-security来实现用户身份验证。我使用nginx进行服务器部署。该配置受aiohttp doc的启发,如下所示:
location /api {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://127.0.0.1:8080/api;
}
Web应用程序的一部分就像相册。我希望照片由ngninx提供以提高性能。我的配置目前看来已经可以使用,但是可以绕过身份验证:
location /photos {
root /srv/web/photos/;
try_files $uri =404;
}
如何使nginx
仅将照片提供给经过身份验证的用户? (如上所述,验证机制由python应用程序实现)