How can I determine which server is used

30 views
Skip to first unread message

Norm Scherer

unread,
Jul 5, 2013, 12:48:00 AM7/5/13
to rubyonra...@googlegroups.com
Rails 2.3.15
The system may be run using mongrel or apache/passenger.  Some functions are not supported in mongrel 1.1.5 but work in apache/passenger therefore I want to know what server is being used so I can alter behavior as needed.

How can I determine in a controller which server is serving the system?

Thanks
Norm

Joel Pearson

unread,
Jul 5, 2013, 3:46:42 AM7/5/13
to rubyonra...@googlegroups.com
I suppose you could check the environment from within the relevant
function.

--
Posted via http://www.ruby-forum.com/.

Frederick Cheung

unread,
Jul 5, 2013, 10:40:21 AM7/5/13
to rubyonra...@googlegroups.com
Pretty crude but you could check defined?(PhusionPassenger)

Fred
 
Thanks
Norm

Norm Scherer

unread,
Jul 5, 2013, 9:42:29 PM7/5/13
to rubyonra...@googlegroups.com
Thanks Frederick and Joel.  Turns out SERVER_SOFTWARE is defined as "Apache/2.2.14 (Ubuntu)" in the environment so I can use that and also PhusionPassenger is defined when running under passenger so that would work also.  Both are fairly crude but they work and that is what I need.  I would prefer to know mongrel is running but that does not seem as easy and this will work.

Norm
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c941a365-9f77-4c7e-95d8-7607c07ae362%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages