Rails application running on Apache HTTPD - ruby-on-rails

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.

Related

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 to run ruby on apache?

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.

Which is the best web server for Ruby on Rails application on Ubuntu?

I tried it by installing Phusion passenger..Phusion passenger was succeessfully installed but while configuring it to Apache i'm facing a problem ....
So can anybody tell me what is the best websever for ruby on rails applications to host them on Ubuntu ...
The combination of Apache and Passenger is a very good web server for Ruby on Rails applications on Ubuntu.
There is very good support, on the web, from Apache, from Phusion and here on Stackoverflow.
Many sites are running Rails on Passenger. The technology is robust and well understood.
Same for Ubuntu.
Same for Apache, only more so.
Basically I'd say that if you are just starting out that you should go with Passenger/Apache unless you have a compelling need for some other stack. Given that you are asking the question without any other details, I'm assuming that you don't have such a compelling need.
The other thing that is true today is that there are lots of choices. You can combine Passenger, or Thin, or Mongrel, or Unicorn with Apache, or Nginx or alone, and you can mix them with Varnish or other cache. Once you have your site configured on one stack, you can move it to another without too much difficulty.
First though, you have to configure it once, and for that Passenger and Apache are a good combination on Ubuntu.
Apache and passenger is reliable and configurable way to go. But if you just want to run single application, the zero configuration way is passenger standalone
gem "passenger"
in your Gemfile and
$ passenger start -e production -p 80
in console should start nginx server in port 80 with production environment. It would automatically install nginx server for you.
If port 80 is not blocked by the firewall, you can access your application from the internet by
http://your-server-ip-address/

I can't install Phusion Passenger to run Rails

The problem is simple.
I use the following command to install Passenger
passenger-install-nginx-module
When Passenger automatically installs nginx, I can't launch it.
nginx -v
Returns there's no nginx installed.
How can I fix this?
Notice that passenger-install-nginx-module asks you where to install Nginx to? The nginx binary is in there. Make sure the appropriate directory is in your $PATH. If you don't know what $PATH is or how to use it then you should read a book about basic Unix/Linux command line skills.
You need install Nginx. the webserver.
If you use passenger 3 in standalone, you just need launch passenger start command
I solved this.
Actually, Passenger did install nginx, it just wasn't in the default category.
I recommend to tell passenger to install nginx in /usr/local/nginx

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