Configuring Nginx for Wordpress and Rails

Posted by Michael Buckbee on Server Fault See other posts from Server Fault or by Michael Buckbee
Published on 2011-01-04T03:52:46Z Indexed on 2011/01/04 3:55 UTC
Read the original article Hit count: 311

Filed under:
|
|
|

I'm trying to setup a single website (domain) that contains both a front end Wordpress installation and a single directory Ruby on Rails application. I can get either one to work successfully on their own, but can't sort out the configuration that would let me coexist.

The following is my best attempt, but it results in all rails requests being picked up by the try_files block and redirected to "/".

server {
    listen 80;
    server_name www.flickscanapp.com;
    root /var/www/flickscansite;
    index index.php;

    try_files $uri $uri/ /index.php;

    location ~ \.php$ {
        include         fastcgi_params;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /var/www/flickscansite$fastcgi_script_name;         
    }

    passenger_enabled on;        
    passenger_base_uri /rails;

}

An example request of the Rails app would be http://www.flickscan.com/rails/movies/upc/025192395925

© Server Fault or respective owner

Related posts about php

Related posts about nginx