server.pid 出错
有时进入了rails后关闭,再一次进入rails后出现了以下错误:
$ rails s
=> Booting WEBrick
=> Rails 4.0.3 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check ××/××/tmp/pids/server.pid.
Exiting
原因: server.pid 出错,进程出现了错误
解决:
$ kill -9 `cat tmp/pids/server.pid`
[1] + 26748 killed rails s
扩展:如何修改webrick端口值
方法一:
打开
ubylib ubygems1.8gems ails-1.2.5libcommandsserverswebrick.rb
rails-{ver}
ver是你当前的rails版本.
找到
OPTIONS = {
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:server_root => File.expand_path(RAILS_ROOT + "/public/"),
:server_type => WEBrick::SimpleServer,
:charset => "UTF-8",
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes
}
把 port 后面的3000修改成你想要的端口号.
ubylib ubygems1.8gems ails-1.2.5libcommandsserverswebrick.rb
rails-{ver}
ver是你当前的rails版本.
找到
OPTIONS = {
:port => 3000,
:ip => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:server_root => File.expand_path(RAILS_ROOT + "/public/"),
:server_type => WEBrick::SimpleServer,
:charset => "UTF-8",
:mime_types => WEBrick::HTTPUtils::DefaultMimeTypes
}
把 port 后面的3000修改成你想要的端口号.
方法二:
ruby script/server -p 3000
http://blog.sina.com.cn/s/blog_465f50b901008ovp.html(感谢该地址作者的分享该博客的扩展内容)