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 have a config file for mydomain.com which is served with Drupal. Problem is this rewrite rule takes the control over any request:

if (!-e $request_filename) {
   rewrite ^/(.*)$ /index.php?q=$1 last;
}

What I'd like to do, is to make mydomain.com/about_me to point to another app which I've written in Rails.

Currently Drupal is served with PHP CGI on port 9000. I tried adding lines to Nginx config such as:

location /about_me {
   proxy_pass $scheme://127.0.0.1:3000;
}

Thanks for suggestions.

share|improve this question
    
You really should use a subdomain in cases like this. –  Michael Hampton Feb 10 '13 at 19:39
    
Why dont you stick that if condition under the (or a) general location directive instead of having it globally within the server context, then? –  3molo Feb 10 '13 at 20:09
    
Michael Hampton: this should work, but it's not exactly what I need. @3molo: i don't fully understand, this if - condition is a catch-all for clean urls. the other one is location ~ \.php {...} which actually passes requests to fastcgi. –  valk Feb 10 '13 at 23:04

1 Answer 1

up vote 0 down vote accepted

Create separate location blocks for the Rails and Drupal paths:

location /about_me {
    proxy_pass $scheme://127.0.0.1:3000;
}

location / {
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
    }
}
share|improve this answer
    
Thanks. This is definitely the way to go. It passes the /about_me to my Rails app. However I get another "You may have mistyped the address or the page may have moved.". Any idea why? Anyway, I decided that I'll go with subdomain, as it really easier and just works. UPDATE: it really works!, one thing to check is that /about_me should be a valid URL in routes.rb! –  valk Feb 11 '13 at 23:58

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.