404 Not Found error in deploying rails 3.2.12 app (with engines) to SUB URI on nginx/passenger -


we need deploy rails 3.2.12 app sub uri nbhy on ubuntu 12.04 server. rails app has 3 engines , 1 of them authentify user authentication. main app's root pointing authentify's signin page. here routes.rb in main app:

  root :to => "authentify::sessions#new"   match '/signin',  :to => 'authentify::sessions#new'   match '/signout', :to => 'authentify::sessions#destroy'   match '/user_menus', :to => 'user_menus#index'   match '/view_handler', :to => 'authentify::application#view_handler' 

the app deployed base uri nbhy running on ubuntu 12.04 passenger , nginx. on same server, there rails app running in own sub uri. here configuration in nginx.conf sub uri nbhy:

server {    listen 80;    server_name 6.95.225.93;    root /var/www/;    passenger_enabled on;    rails_env production;    passenger_base_uri /by;    passenger_base_uri /nbhy;     #for rails >=3.1, assets pipeline    location ~ ^/assets/ {      expires max;      add_header cache-control public;      add_header etag "";      break;    } } 

also symlink nbhy created @ document root /var/www pointing /var/www/nbhyop/current/public. here output of root /var/www/:

total 8 lrwxrwxrwx 1 cjadmin www-data   28 nov  3  2012 -> /var/www/byop/current/public drwxrwsr-x 4 cjadmin www-data 4096 nov  4  2012 byop lrwxrwxrwx 1 cjadmin www-data   30 may 16 21:27 nbhy -> /var/www/nbhyop/current/public drwxrwsr-x 4 cjadmin www-data 4096 may 14 15:21 nbhyop 

the by first rails app deployed sub uri , working fine.

the login page displayed after typing http://6.95.225.93/nbhy. after key in user , password, page redirected http://6.95.225.93/authentify/session 404 not found error. there error found in nginx error.log:

2013/05/13 16:29:25 [error] 2384#0: *1 open() "/var/www/authentify/session" failed (2: no such file or directory), client: 192.168.1.1, server: 6.95.225.93, request: "post /authentify/session http/1.1", host: "6.95.225.93", referrer: "http://6.95.225.93/nbhy/" 

obviously /var/www/authentify/session not hit right page because missing base uri nbhy between www , authentify. based on our analysis, create in authentify session controller hasn't been hit , user hasn't been authenticated right user name , password @ http://6.95.225.93/nbhy.

also find out user can login @ http://6.95.225.93/nbhy/authentify/session/new twist. after login page redirected http://6.95.225.93/user_menus throw out 404 not found error. if insert nbhy in between : http://6.95.225.93/nbhy/user_menus, bring user menus page successfully. further click on links, manually inserting nbhy make link work (if nbhy missing).

the rails app worked fine when deploying without sub uri.

why sub uri missing route? there way can make nbhy here stay , eliminate error? help.

most authentify engine doing redirect /user_menus, instead of /nbhy/authentify. custom rails or sinatra app have written? if so, need change/configure code of authentify append current subdirectory under rails app hosted. can passenger saying env['rails_relative_url_root'] in code.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -