Bitnami ruby​​stack部署自己的应用程序,RoutingError

时间:2015-01-16 10:32:54

标签: ruby-on-rails apache passenger bitnami

我修改了三个文件, /Applications/rubystack-2.0.0-23/apache2/conf/bitnami/bitnami-apps-prefix.conf  添加

Include "/Applications/rubystack-2.0.0-23/apps/destiny/conf/httpd-prefix.conf"

到bitnami-apps-prefix.conf

app / destiny / conf中的mkdir

的httpd-app.conf

<Directory "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public">
    Options -MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>
    PassengerFriendlyErrorPages on
    PassengerEnabled on
    SetEnv RAILS_RELATIVE_URL_ROOT "/destiny"
    PassengerAppRoot "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/"
    <IfModule pagespeed_module>
        ModPagespeedDisallow "*"
    </IfModule>


</Directory>
PassengerPreStart `http://127.0.0.1:8080/destiny`

的httpd-prefix.conf

Alias /destiny/ "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public/"
Alias /destiny "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public"

Include "/Applications/rubystack-2.0.0-23/apps/destiny/conf/httpd-app.conf"

的httpd-vhosts.conf

<VirtualHost *:8080>
    ServerName `redmine.example.com`
    ServerAlias `www.redmine.example.com`
    DocumentRoot "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public"

    Include "/Applications/rubystack-2.0.0-23/apps/destiny/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:8443>
    ServerName redmine.example.com
    ServerAlias www.redmine.example.com
    DocumentRoot "/Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public"
    SSLEngine on
    SSLCertificateFile "/Applications/rubystack-2.0.0-23/apps/destiny/conf/certs/server.crt"
    SSLCertificateKeyFile "/Applications/rubystack-2.0.0-23/apps/destiny/conf/certs/server.key"

    Include "/Applications/rubystack-2.0.0-23/apps/destiny/conf/httpd-app.conf"
</VirtualHost>

myapp root dir是

/Applications/rubystack-2.0.0-23/apps/destiny/htdocs 

然后我收到了错误

App 88664 stdout: Started GET "/destiny" for 127.0.0.1 at 2015-01-16 17:51:46 +0800
App 88664 stdout: 
App 88664 stdout: ActionController::RoutingError (No route matches [GET] "/destiny"):
App 88664 stdout:   actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
App 88664 stdout:   actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
App 88664 stdout:   railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
App 88664 stdout:   railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
App 88664 stdout:   activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
App 88664 stdout:   activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
App 88664 stdout:   activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
App 88664 stdout:   railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
App 88664 stdout:   actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
App 88664 stdout:   rack (1.6.0) lib/rack/methodoverride.rb:22:in `call'
App 88664 stdout:   rack (1.6.0) lib/rack/runtime.rb:18:in `call'
App 88664 stdout:   activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
App 88664 stdout:   actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
App 88664 stdout:   rack (1.
App 88664 stdout: 6.0) lib/rack/sendfile.rb:113:in `call'
App 88664 stdout:   railties (4.2.0) lib/rails/engine.rb:518:in `call'
App 88664 stdout:   railties (4.2.0) lib/rails/application.rb:164:in `call'
App 88664 stdout:   passenger (4.0.53) lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
App 88664 stdout:   passenger (4.0.53) lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
App 88664 stdout:   passenger (4.0.53) lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
App 88664 stdout:   passenger (4.0.53) lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'

它出了什么问题!

  

/命运

是url前缀根路径,为什么我得到“ActionController::RoutingError”!这些不需要在routes.rb中写入。 任何人都可以告诉我一个配置它的正确方法!这对我来说太麻烦了。让我疯狂。 TNX 我只关注redmine的配置。 我键入http://127.0.0.1:8080/destiny时 这是结果 enter image description here

注意:当我在webrick中测试时,它工作正常。所以它不应该是应用程序的问题!

1 个答案:

答案 0 :(得分:0)

RESLOVED:

的Apache +乘客:在

router.rb

Rails.application.routes.draw do
scope "/destiny" do
  ......
root to 'user#new'
end

production.rb

config.assets.compile = false更改为config.assets.compile = true

的Nginx +乘客

nginx.conf

server {
    listen 8080;
    server_name 127.0.0.1;
    root /Applications/rubystack-2.0.0-23/apps/destiny/htdocs/public;
    passenger_enabled on;
    passenger_friendly_error_pages on;

    error_log  var/error_log  debug;
    # pagespeed on;
    # pagespeed FileCachePath /Applications/rubystack-2.0.0-23/nginx/var/ngx_pagespeed_cache;

    #  Ensure requests for pagespeed optimized resources go to the pagespeed
    #  handler and no extraneous headers get set.


 location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }

}

不需要在production.rb

中设置config.assets.compile = false