Unable to set up Rails app by Apache on Mac OS X 10.9.3

Yes, I did add that line in the .conf file inside sites folder and also add RackEnv development

above PassengerRuby directive as below:

ServerName ... ServerAdmin admin@example.com DocumentRoot "/Library/WebServer/most/public" DirectoryIndex index.html index.php /wiki/ /xcode/ default.html CustomLog /var/log/apache2/access_log combinedvhost ErrorLog /var/log/apache2/error_log SSLEngine Off SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM" SSLProtocol -ALL +SSLv3 +TLSv1 SSLProxyEngine On SSLProxyProtocol -ALL +SSLv3 +TLSv1 Options All -Indexes -ExecCGI -Includes +MultiViews AllowOverride None DAV Off Deny from all ErrorDocument 403 /customerror/websitesoff403.html RackEnv development PassengerRuby /usr/local/var/rbenv/versions/2.1.0/bin/ruby

the error I got now seem to be something different…

  integer 4294967294 too big to convert to `int' (RangeError)
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:724:  in `chown'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:724:  in `block in remove_entry_secure'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:718:  in `open'
/usr/local/var/rbenv/versions/2.1.0/lib/ruby/2.1.0/fileutils.rb:718:  in `remove_entry_secure'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/utils/tmpio.rb:72:  in `ensure in mktmpdir'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/utils/tmpio.rb:72:  in `mktmpdir'
/usr/local/Cellar/passenger/4.0.45/libexec/lib/phusion_passenger/native_support.rb:147:in
....

User and groups

uid=4294967294(nobody) gid=4294967294(nobody) groups=4294967294(nobody),12(everyone),61(localaccounts),
404(com.apple.sharepoint.group.4),403(com.apple.sharepoint.group.3),100(_lpoperator),
401(com.apple.sharepoint.group.1),402(com.apple.sharepoint.group.2)

Environment variables


4294967294 is actually "-2", default uid and gid for nobody in Mac OS X.

Not sure how to get around this, change ownership of some files will help?

Liz

Who is the owner of your rails app? Passenger will run your app as the user set as the owner of the rails root (or maybe the environment file, not sure). For development, I just set myself as the owner. For deployment, you may want to set up an unprivileged user to own the rails app, but apparently Passenger has issues if the “nobody” user owns the app.

Jim

Yes, “nobody” is the owner and it seems to be a bug with Ruby. I will change the ownship of the rails project to see if it fixes the problem.

Liz

Yes! passenger will start up according to the ownership of config.ru file (>rails 3, or environment.rb for rails 1 & 2) and has issue if it is owned by “nobody”. I change ownership of config.ru file and it works now. Thanks a lot for your help! Now I can host single rails app, will need to figure out how to set up multiple rails apps by sub URI.

Best, Liz

If you've ever configured Apache for multiple name-based virtual hosts, you will have already done this. I host many Rails apps (non-critical) on my staging server, and Passenger makes it trivial to add another one. Just add the virtual host config file, make sure that the Directory statement therein points to the new app's public folder, and you're done.

As long as these sites aren't popular, there's really no limit to the number of them you can run, because Passenger will allow them to spin down if they don't get any requests, and you will get your memory back to use elsewhere. Of course if they all get crawled by Google at once, your server WILL fall over.

Walter

Hey, try out our new service http://teatro.io, which allow you to run stage server automatically in the cloud.