Configuring Nginx for Wordpress and Rails
- by Michael Buckbee
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