Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 Nginx 中查看当前访问者是否登录。是否可以在 Nginx 中访问会话变量(或至少是会话 ID)?
先感谢您。
好吧,这些信息不足以回答您的问题。什么编程语言,什么会话系统,...?
您可以访问 cookie 并查看是否存在具有特定偏移量的 cookie。您将无法验证它,但至少您会提示用户是否已登录。不知道这是否符合您的要求。
location / { if ($http_cookie ~ SESSIONID) { // hello there possibly logged in user } }