简体   繁体   中英

Why would running a Rails app as a WEBrick server work, but installing it as a Mongrel service would not?

Yet another newbie RoR question from me.

I started banging my head against a wall last night when I simply could not get my Rails app to display in my browser after installing it as a Mongrel service.

I installed it using a command like this (from the app's root directory):

mongrel_rails service::install -N MyAppName -e development -p 3000

This set up the Windows service and everything seemed to be just fine. I could start/stop the service and saw no errors in the logs. Then navigating to localhost:3000 in my browser, I was greeted with a variety of errors, none Rails-specific (all along the lines of "Could not connect to server" or the like). Consulting the log at this point revealed no obvious problems.

I could not for the life of me figure out how to get this to work. So, out of exasperation, I tried simply running the app on WEBrick instead:

ruby script/server webrick -p 3000

When I did this , my app ran perfectly! Opening my browser to localhost:3000 now displayed my front page as expected.

I should note that I have used Mongrel successfully for other apps on my local machine.

So what app-specific characteristics could be responsible for WEBrick working where Mongrel doesn't?

Just some ideas to try:

  1. Add -c param with full path to application: -c "C:\\xxx\\yyy\\zzz"

  2. Check if system-wide PATH environment variable contains ruby bin directory - maybe just user's PATH is set.

  3. Switch service to run as your user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM