ROR + 服务器已在运行.检查.../tmp/pids/server.pid.退出 [英] ROR + A server is already running. Check .../tmp/pids/server.pid. Exiting
问题描述
在我的 Rails 项目中,我试图在不同的端口运行两个不同的服务器.但是它在控制台上给出了这个错误而失败了.
In my Rails Project, I am trying to run two different servers at different port. But it fails by giving this error at console.
C:\Rails>rails s
=> Booting Mongrel
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
A server is already running. Check C:/Rails/tmp/pids/server.pid.Exiting
请检查更新的答案.
推荐答案
在谷歌搜索了很多之后,我只是删除了那个文件并重新启动了服务器.然后系统再次创建该文件,然后我再次删除该文件.现在服务器运行良好.并且系统在同一个地方生成另一个副本.但它运行良好.
After googling a lot, I just delete that file and restart the server. Then again system create that file, then again I delete that file. Now Server is running fine. And System generates another copy at the same place. But it is running well.
DELETE THAT FILE ....
如果你想运行两台服务器,那么它可能会再次制造麻烦.所以
If you want to run two servers then it may again create trouble. So
这两个命令都在检查默认 PID 文件位置 (tmp/pids/server.pid),因此您会看到此错误.尝试像这样运行多个服务器:
Both commands are checking the default PID file location (tmp/pids/server.pid), so you're seeing this error. Try running multiple servers like so:
Server 1: bundle exec rails s
Server 2: bundle exec rails s -p 3001 -P tmp/pids/server2.pid
来源:https://stackoverflow.com/a/14446920/1376448
谢谢
UPDATE 在 Connor Leech 评论 Forman Gem 之后
UPDATE after Connor Leech comment about Forman Gem
Foreman 可以帮助管理 Rails 应用程序依赖的多个进程在开发中运行时.它还提供了一个导出命令将它们投入生产.
Foreman can help manage multiple processes that your Rails app depends upon when running in development. It also provides an export command to move them into production.
这篇关于ROR + 服务器已在运行.检查.../tmp/pids/server.pid.退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!