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'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 them 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_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

share|improve this question
Can you give us some more information about your directory structure. It would be most common to see something like: location /blog {} AND location / {} To differentiate the two different apps. Also see, stackoverflow.com/questions/89504/… –  Andrew Taylor Jan 4 '11 at 8:41
I'm basically trying to do the opposite of that SO question. I have /var/www/flickscansite (wordpress) and /var/www/flickscanapp (rails), in the /var/www/flickscansite I have a symlink "/rails" that points to the app directory (which works if I remove the php fastcgi config). I'm trying to use Wordpress as a lightweight CMS and then "embed" a rails app for use elsewhere. –  Mike Buckbee Jan 4 '11 at 9:43
Andrew, I was able to sort out a solution by adding a location /rails {} section to the config. Good job finding that SO question, why don't you add it as an answer so I can upvote and accept your answer. Thanks. –  Mike Buckbee Jan 4 '11 at 9:50

Your Answer


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

Browse other questions tagged or ask your own question.