我正在尝试在Nginx + Passenger上安装Tracks,并在尝试访问该网站时收到以下错误:
The page you were looking for doesn't exist.
当我检查/log/production.log
时,我看到以下记录:
ActionController::RoutingError (No route matches [GET] "/tracks"):
actionpack (4.1.11) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.1.11) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.11) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.11) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.11) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.11) lib/active_support/tagged_logging.rb:26:in `tagged'
我怀疑我尝试在我的域中使用sub-uri的问题,即www.example.com/tracks
,例如Redmine我需要在environment.rb
添加以下行:
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }
...
Redmine::Utils::relative_url_root = "/redmine"
也许我需要在Tracks进行相同的更改,但我不知道rails。
这是来自负责此曲目的nginx.conf
的配置:
location /tracks {
passenger_enabled on;
alias /opt/tracks/public;
index index.html index.htm;
}
提前谢谢。
答案 0 :(得分:0)
好的,感谢我的朋友,他向我指出了这个教程:https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#deploying-an-app-to-a-sub-uri之后我在nginx.conf
部分location /tracks
中更改了以下内容:
location /tracks {
passenger_base_uri /tracks;
passenger_app_root /opt/tracks;
passenger_document_root /opt/tracks/public;
passenger_enabled on;
alias /opt/tracks/public;
index index.html index.htm;
}
它解决了这个问题。