每当我使用
rails s
我收到这条消息:
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-12 19:57:32] INFO WEBrick 1.3.1
[2012-08-12 19:57:32] INFO ruby 1.9.3 (2012-04-20) [i686-linux]
[2012-08-12 19:57:32] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /home/abhishek/.rvm/rubies/ruby-1.9.3- p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `block in create_listeners'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:82:in `each'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:82:in `create_listeners'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:82:in `listen'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:70:in `initialize'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:45:in `initialize'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack- 1.3.6/lib/rack/handler/webrick.rb:10:in `new'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.3.6/lib/rack/handler/webrick.rb:10:in `run'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.3.6/lib/rack/server.rb:265:in `start'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in `start'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
然后我必须使用
ps aux | grep rails
和
kill -9 <pid>
rails s
我的问题是:
有没有办法让我不必这样做,我可以使用轻松运行服务器
rails s
每次..
即使..命令
rails s -p 4000
作品..
我只是好奇是否有什么方法可以让我每次都使用同一个端口……这样我就不必每次启动服务器时都从不同的端口开始,因为这让我不得不重新输入特定的控制器和动作名称一次又一次...