0

我正在尝试在 rails 4 中使用 UTF8 路由

get '/документы', to: 'static_pages#docs', as: :docs

它在 WEBrick 上工作得很好,但在战场上不起作用(nginx+passenger)

我猜是因为 nginx 使我的 url 小写

No route matches [GET] "/%d0%b4%d0%be%d0%ba%d1%83%d0%bc%d0%b5%d0%bd%d1%82%d1%8b"

但是rails希望它是大写的

Started GET "/%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B" for 127.0.0.1
Completed 200 OK in 52ms (Views: 49.0ms | ActiveRecord: 1.0ms)

有什么方法可以让 nginx 理解 unicode 路由?

这是我的 nginx 服务器配置

server {
   listen 80;
   server_name website.com;

   charset utf8;

   root /web/website/public;

   location ~ ^/assets/ {
      root /web/website/public;
      expires 1y;
      add_header Cache-Control public;#
      add_header ETag "";
      break;
   }

   error_page  502 404 /502.html;

   passenger_enabled on;
   rails_spawn_method smart;
   rails_env production;
 }
4

0 回答 0