跨越的Node.js和nginx的认证 [英] Authentication across node.js and nginx
问题描述
由于大多数我的内容是静态的我正打算有nginx的处理静态文件的投放。但是,静态内容也是私有的。不同的用户有不同的内容。
As most of my content is static i was planning to have nginx to handle the serving of static files. But the static content is also private. Different users have different content.
本身是用node.js中的应用/ EX press.js
The application itself is written in node.js/express.js
和我不知道我应该如何处理身份验证/授权。这有什么,这方面的任何nginx的模块。
And i was wondering how i should handle authentication/authorization. Is there anything, any nginx module for this.
像node.js的东西放一些令牌的memcached nginx的其中查找要求或类似的东西?
Something like node.js put some token in memcached which nginx looks up upon request or something like that?
推荐答案
是的,有这样一个特点,收银台下面的更详细的文章:
Yes, there is such a feature, checkout the following more detailed articles:
- http://wiki.nginx.org/XSendfile
- http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
所有你所要做的就是让Node.js的与该文件的位置设置的头X-阿塞尔 - 重定向发送文件到nginx的路径。
All you have to do is to make a Node.js send the path of the file to NGiNX by setting the header "X-Accel-Redirect" with the location of that file.
这篇关于跨越的Node.js和nginx的认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!