LINUX.ORG.RU

изменить server root для webrick

 ,


0

1

помогите пожалуйста поменять server root path для сервера webrick, работающего с рельсами. мне нужно его направить в каталог /public

я запускаю сервер из консоли и получаю ошибку:

kalinin@kalinin ~/rails/admin_book $ rails s --config=webrick_conf.rb
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-09-22 17:17:21] INFO  WEBrick 1.3.1
[2015-09-22 17:17:21] INFO  ruby 2.0.0 (2014-11-13) [x86_64-linux]
[2015-09-22 17:17:21] WARN  TCPServer Error: Address already in use - bind(2)
Exiting
/home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.4/lib/rack/builder.rb:43:in `const_get': uninitialized constant Webrick_conf (NameError)
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.4/lib/rack/builder.rb:43:in `parse_file'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/server.rb:78:in `start'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/kalinin/rails/admin_book/bin/rails:8:in `require'
from /home/kalinin/rails/admin_book/bin/rails:8:in `<top (required)>'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `load'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/client/rails.rb:28:in `call'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/client/command.rb:7:in `call'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/client.rb:28:in `run'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/bin/spring:49:in `<top (required)>'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `load'
from /home/kalinin/.rvm/gems/ruby-2.0.0-p598/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/kalinin/rails/admin_book/bin/spring:13:in `require'
from /home/kalinin/rails/admin_book/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

при этом файл webrick_conf.rb находится в корневом каталоге рельс и содержит:

require 'webrick'

root = File.expand_path '~/public'
server = WEBrick::HTTPServer.new :Port => 3000, :DocumentRoot => root

Добавь server.start в webrick_conf.rb (последней строчкой).

А ещё:

[2015-09-22 17:17:21] WARN TCPServer Error: Address already in use - bind(2)

Take a look at this.

neversleep ★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.