How to deploy Rails project in Nginx server using passenger? - ruby-on-rails

In my local, I am using werbrick application server for my localhost.
I have Ruby version 1.9.2 .and Rails version 3.1.
How to deploy On live,with Rails Project On Nginx Server?
And What will be the application server (like passenger module with apache) can be used with Nginx server for Rails 3.1 application?

This blog post should give you a good starting point. This one here goes a little deeper in detail. Note: I used these to get nginx running on my local development machine (OSX 10.7) and to host different rails apps locally without using Webrick. Probably there is more to take care of on a live / production system.

Related

How to deploy a rails project on a Ubuntu server?

I've developed my Rails project locally and want to deploy it on my Ubuntu VPS. Now I've installed the gems on the VPS and copied my Rails App code to it. I can execute rails s --binding=0.0.0.0 in a putty session to the VPS and the website can be access from the Internet. The problem is when I close putty, the website is down. How to start my Rails App in a way that it still alive even if I closed putty?
Using rails s is not the way to go. It will use Webrick(or a different one if you choose) to handle the requests and it can be quite slow.
You should setup a production stack for serving your website.
Here is one of the best tutorials I've seen about how to deploy a Rails app to a production server(VPS).
In short you gonna need install RVM or Rbenv, Ruby, some libs, Database, Nginx and Passenger. You have alternatives too. But this is the basic.
I recommend using Capistrano for deploy. You can choose another deployment tool also, or none.
rails s it is best for development only.

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 start a rails application on a tcserver?

I have tried to run rails on mongrel, so i included gem 'mongrel' in the gemfile and started rails server mongrel, the server started fine. But i need to start rails on 'tcserver'. How can i do that?. rails server tcserver throws LoadError: no such file to load -- rack/handler/tcserver which is quite obvious. Please let me know how to start a rails application on a tcserver
Vfabric TC Server is an adaption of Apache Tomcat, and as such is a Java servlet container. It does not run Ruby-on-Rails as is.
You would need to use JRuby, and a tool such as Warbler, which packages Rails apps into WARs compatible with Tomcat.
This Is a good step-by-step for the process. (Replace Tomcat with TC server instance)

Server setup option for rails with different ruby and rails versions

I'm in the process of setting up my VPS (linode) to host a few rails websites. What are some good options for setting up one server that will be hosting rails websites that are on different versions of rails and ruby. For example
foo.com - ruby 1.9.2, rails 3.0
bar.com - ruby 1.9.3, rails 3.2.3
I've seen only one blog post (using passenger) regarding a setup like this but I'm interested in finding out what some other solutions look like. Or if this is a BAD idea and I should be using different VPS's for each I'd like to know othat too.
You can use for example standalone Passenger or Unicorn instances per application, and reversproxy them via Apache or Nginx so it will respond on default port 80

Recommended development web server for Rails 3.1 and Ruby 1.9.2

I have been using Mongrel successfully with rails 2.* and 3.0* development, with ruby 1.8.7.
I recently started working with Rails 3.1 and ruby 1.9.2. I got my test app running with WEBrick. I don't like WEBrick. If I forget and simply close the WEBrick terminal window instead of going into the window and issuing a Control-C to WEBrick, the server port (3000) stays in use, and I can't run 'rails server' again until I log out everything and get WEBrick cleared out of the port table. Mongrel never had that problem.
I do have a build problem with Mongrel and ruby-1.9.2. I get multiple header files in the build, some referring to ruby-1.9.1 and some ruby-1.9.2. What a mess.
What is the recommended development web server for my config, which is 32-bit Ubuntu Natty with Rails 3.1 and ruby 1.9.2?
Webrick works well for me. The only problem I had is that it did not work well with https secure. The solution was to only run https on staging and production, not on development machine.
I use the dev machine only as the server, and develop on Windows machine with Notepad++. I think it works well, after using a horrible Rails IDE. (I used to use Visual Studio and love it.) Access the web page through local IP and port. It's a cheap, fast easy solution for Windows users.
I am running Ubuntu 11.04, Rails 3.07, Ruby 1.92 with RVM, and PostgreSQL. RVM is supposed to make life easy for Ubuntu users, because Ubuntu uses a different version of Ruby.
To kill the server process running on port 3000: xxxx is the value returned from the first line.
$ lsof | grep 3000
$ kill -9 xxxx
This could easily be combined into one line or an alias killserver or similar.
Thanks for the various port listener kill commands, I will construct something simple to clear the WEBrick's irritating habit, and continue to use it. Chasing a development web server issue is low on my priority list; they should just work.
You can see from my questions that my Linux skills don't go very deep into the kernel.

Resources