Location / rewrite help needed
saile
nginx-forum at nginx.us
Thu Dec 3 11:10:48 MSK 2009
Hi,
let's say I use upstream to push the requests to Rails for example like this:
upstream thin {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
root /var/www/test/public;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin;
break;
}
}
}
Is it possible to define a second location which not should redirect the request to the upstream but instead redirect to a folder with static files in it?
How would you do that?
Regards
Elias
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,27611,27611#msg-27611
More information about the nginx
mailing list