Cartoon
Cartoon

Reputation: 111

Setting root path to rails app's root_path in nginx

I've configured a rails app on Digital Ocean (DO) using passenger, nginx and capistrano. Everything is working fine expect that I want to get the application's root_path page to be displayed whenever I go to the website. But that's not the case. I've to keep another page index.html in public directory and set it to root like:

xyz.conf file

root /home/user/apps/xyz/current/public;

I don't want this extra static page to be displayed. It just doesn't look good. Instead I want the application's root page which I specified in routes.rb file like root 'controller#method' to be displayed.

I've tried removing root line or restricting it to just /home/user/apps/xyz/current in .conf file but that just gives a 403 Forbidden error which should be the case.

I've thought a lot but can't think of anything. Anyone out there who had a similar problem and managed to figure it out?

Upvotes: 1

Views: 1698

Answers (1)

Hardik Upadhyay
Hardik Upadhyay

Reputation: 2659

Your nginx root is must be like:

root /home/rails/sample_tasks/public;

Note: path may vary but you need to set path till your app's public folder

then reload you Nginx

service nginx reload 

Upvotes: 2

Related Questions