Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a rewrite rule for ngnix to redirect everything request that starts with: /node (i.e domain.com/node/something/somthingelse) to domain.com:3000/something/somthingelse.

Could anyone show me how to accomplish that ?

Many thanks

share|improve this question
up vote 1 down vote accepted

It is achieved with locations like this:

server {
    server_name domain.com;
    location ^~ /node/ {
        rewrite ^\/node\/(.*)$ http://domain.com:3000/$1 break;
    }
}

See nginx documentation for details.

share|improve this answer
    
Thank you both, that did the trick! – silkAdmin Mar 19 '12 at 20:34

Does this work?

location /node {
  rewrite /node/(.*)   http://domain.com:3000/$1 ;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.