nginx,乘客只显示根页面,所有其他路线都失败

nginx, passenger only showing root page, all other routes fail

Nginx + passenger 仅显示根页面/路径,所有其他路由都失败并显示 404 Not Found。 我知道 nginx 和 passenger 必须 运行 正确调出根路径。这是可用站点的条目:

    server {
      listen 80;
      server_name staging.redacted.com; # Replace this with your site's domain.

      passenger_enabled on;
      passenger_app_env staging;

      keepalive_timeout 300;

      client_max_body_size 4G;

      root /var/www/staging.redacted.com/current/public; # Set this to the public folder location of your Rails application.

      #try_files $uri/index.html $uri.html $uri;
      try_files $uri $uri/ =404;

    }

routes.rb - 尽管它们都能正常工作并通过了规格。

    Rails.application.routes.draw do

      resources :users

      resources :brand_api_keys

      resources :ir_service_buckets
      resources :ir_service_images
      resources :ir_services do
        resources :ir_service_buckets do
          resources :ir_service_images
        end
      end
      resources :devices do
        resources :scans
      end
      resources :images do
        resources :scans
      end
      resources :campaigns do
        resources :images
      end
      resources :agent_brands
      resources :brands do
        resources :brand_api_keys
        resources :ir_service_buckets do
          resources :ir_service_images
        end
        resources :agent_brands
        resources :campaigns
      end
      resources :agents do
        resources :brand_api_keys
        resources :agent_brands
      end

      root 'agents#index'
    end

尝试删除 try_files $uri $uri/ =404; 完全删除或注释掉 try_files 行,它将起作用。