Reputation: 169
I'm trying to understand nginx redirects and rewrites, and it's hard for me to find resources on concrete examples of redirection
location / {
proxy_pass http://localhost:3000/GoToNewSubdirectory/
}
(Assuming a "standard" nginx setup => will redirect access to http://yoursite.com to http://yoursite.com/GoToNewSubdirectory).
One of my basic questions is where does %{REQUEST_URI} come from? How do you find out what these special variables mean, and is there a list of them with explicit definitions and examples?
I'm really just getting into linux and serving websites using tools like apache and nginx, and I 'm having a hard time finding the definitive source for these issues.
Upvotes: 0
Views: 496
Reputation: 12700
It's a CGI environment variable: http://en.wikipedia.org/wiki/Common_Gateway_Interface
The %{VAR} syntax you're referring is how you refer to variables in mod_rewrite. The docs for it is here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteCond
I'm not familiar with nginx, but what you're describing is similar to apache. They must have kept things similar for people that are familiar with apache. Try searching for a mod_rewrite tutorial.
Upvotes: 2