1
我開發了一個帶rails的api,在localhost中一切正常。 但是當我的API是在督促服務器,我得到的錯誤與我的路線......Rails API路由問題(僅在nginx +獨角獸生產中)
這裏的情景:
- 我的督促服務器配置了nginx的和麒麟
- 即時通訊使用的子域,版本我的路線(api.servername/V1 /資源)
的routes.rb文件:
constraints subdomain: 'api' do
scope module: 'api' do
namespace :v1 do
resources :tests, param: :name do
member do
get 'perform'
end
end
resources :jobs
end
end
end
nginx的的conf文件:
server {
listen 80;
server_name *.server.com.br;
# Application root, as defined previously
root rails_public_path;
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://appname;
proxy_connect_timeout 1800;
proxy_read_timeout 1800;
}}
當我運行在督促
rake routes
,我的路線是有的,但麒麟返回404頁。
感謝的人!也爲我工作。使用passenger + apache。 – 2015-01-27 13:19:18