Welcome! Log In Create A New Profile


Location / rewrite help needed

December 03, 2009 03:10AM

let's say I use upstream to push the requests to Rails for example like this:

upstream thin {

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;

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?


Subject Author Posted

Location / rewrite help needed

saile December 03, 2009 03:10AM

Re: Location / rewrite help needed

Igor Sysoev December 03, 2009 03:22AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready