How to run ruby on apache? - ruby-on-rails

I'm very new to ruby and I can run ruby scripts on command line easily, but I want to output my script to a browser, not just using the command line.
Your help will be much appreciated, thanks.

Passenger is probably the easiest way to run Rails applications.

I'd recommend either Passenger or Unicorn, both of which are extremely popular in production environments. Passenger is typically easier to setup.
See this blog post:
"Install RVM, Passenger, Nginx and Rails 3 on Ubuntu Lucid Lynx". You can use WEBrick/Thin for development perhaps.

Related

Ruby on rails Production mode on apache2

I am trying to switch from development mode to production my project in ruby on rails. Do I really need to install passenger? I have already apache server running in the system. Please advise. Thanks.
Yes, You need to install passenger to configure your rails app with Apache server. Here is the step by step solution for the same.

Rails application running on Apache HTTPD

Is there a way to run Ruby on Rails app on Apache HTTPD (CentOS)?
Is this just a matter of setting up httpd.conf with VirtualHost?
Passenger is probably the easiest way to get that running. Here's a tutorial on installing Passenger on CentOS6, and here are prebuilt rpms.
http://rubyonrails.org/deploy
Check Rails site, I think you have to use a Proxy, unless I'm misunderstanding what you mean by HTTPD. Seems like you want a simple Apache setup, Rails should be able to help.
EDIT: James answer looks perfect. Same as mine, but he has real CENTOS tutorials... I've never used CENTOS, just done this through Ubuntu.
You can run mod_rails aka Passenger or a Mongrel Cluster or Thin Cluster.
I find passenger the easiest, you can download it Here
The Steps are quite easy
sudo gem install passenger
sudo passenger-install-apache2-module
Follow instructions on screen.

Running nginx in rails automatically

I am using rails 2.3.9, rubygems 1.8.24, ruby 1.9.3 and Windows 7 ultimate 64-bit
I just installed nginx as my web server through passenger. Now I want to run nginx as my default server such that when i run ruby script/server, it runs instead of the default WeBrick. Is there any way to do this? Thanks a million.
Nginx doesn't work the way you described. Once it is started, you won't need to run script/server, the rails app will be run at the same time when the Nginx/Apache started.
So, just deploy your rails app following the 'Passenger' manual( in development mode), and you will get your app always running.
so, as conclusion, we can tell that, when deploying a Rails app, Nginx and Apache is in the same group( work together with Passenger), and Mongrel/Webrick/Thin is another group(script/server approach).
You may want to take a look at Foreman.

How can I deploy Ruby On Rails Application in Apache in LAMP on ubuntu without installing Ruby and rails

Please provide me the guidance for deploying the ruby on rails application in apache in lamp without installing Ruby or rails?
You need it. Install ruby with all dependencies and install Phusion Passanger. The way I read your question was like this, lets go ride the bicycle with no wheels, let me check my email with no browser - it does not make sense.
you may use Phusion Passenger with Apache for deploying the ruby on rails application.
If it is Ubuntu, all the dependencies are just an apt-get line of code away, so it is well worth install it someway

How to configure ruby on rails with Apache

i have strugle in connection between J2me and ruby on rails under Webrick server...
dats why i need configure with apache..i saw some tutorials about configuring..but it's not working..
You need to install Phusion Passenger: http://www.modrails.com/
Also, for performance improvement, do install REE: http://www.rubyenterpriseedition.com/
What environment are you coming from? Unix, Mac, Windows? Let's assume you're using some Unix variant, as you should, and Apache2 is already properly installed:
1 - install phusion passenger:
$ gem install passenger
2 - install passenger-apache2-module:
$ passenger-install-apache2-module
Be sure to read what the passenger-install-apache2-module command output is telling you, in the end it will give you some lines you have to put in some apache configuration files, if you miss that, it won't work. At all.
3 - Edit your vhosts.conf file (under /etc/apache2/) to define a hostname for your application, point to your application's public folder, etc.
VirtualHost examples
4 - Profit.
Commands listed under 1. and 2. might need admin privileges, it all depends on how your environment is set.
WebRick is not for production environments at all, in fact, it's not really good for development either, if you intend on doing some slightly more complex stuff with your rails applications. Other than that, you didn't really give enough detail about your problem, so I hope this answer at least points you in the right direction.

Resources