Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

Does this work?

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

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.