我试图了解 nginx 重定向和重写,但我很难找到有关重定向具体示例的资源
location / {
proxy_pass http://localhost:3000/GoToNewSubdirectory/
}
(假设“标准”nginx 设置 => 会将对 http://yoursite.com 的访问重定向到 http://yoursite.com/GoToNewSubdirectory ).
我的一个基本问题是 %{REQUEST_URI} 来自哪里?您如何找出这些特殊变量的含义,是否有包含明确定义和示例的列表?
我真的刚刚接触 linux 并使用 apache 和 nginx 等工具为网站提供服务,我很难找到这些问题的确切来源。
最佳答案
这是一个 CGI 环境变量:http://en.wikipedia.org/wiki/Common_Gateway_Interface
您所指的 %{VAR} 语法是您在 mod_rewrite 中引用变量的方式。它的文档在这里:http://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteCond
我对 nginx 不熟悉,但你所描述的与 apache 类似。他们一定为熟悉 Apache 的人保留了类似的东西。尝试搜索 mod_rewrite 教程。
关于linux - 基本: Where does %{REQUEST_URI} come from,是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11182219/