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.
Related
I am running a rails server on an Ubuntu EC2 instance and have run into an issue when it comes to deploying (and restarting) my server. The odd thing is; everything seems to work fine when I start a vanilla server (rails server), but when I start the server as a daemon it does not reset (rails server -d).
I use Capistrano to do deployment. As far as I can tell there is no issue; it pulls down my latest branch, runs migrations and does a touch tmp/restart.txt. I had tried making my tmp/restart.txt a shared file, but that does not seem to be the issue (although it is a configuration I think I'll keep). After discovering Capistrano is likely working as expected I tried sshing into the server and running touch tmp/restart.txt myself. It works for the vanilla server but not the daemon.
Has anyone seen this issue before? If there is more info I could provide please let me know!
Env:
ruby 2.6.3p62 #/home/deploy/.rvm/rubies/ruby-2.6.3/bin/ruby
Rails 5.2.3 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/rails
Bundler version 2.1.2 #/home/deploy/.rvm/gems/ruby-2.6.3/bin/bundle
Node v13.8.0 #/home/deploy/.nvm/versions/node/v13.8.0/bin/node
My logs, tmp, and config/master.key are shared as part of my Capistrano setup.
are you using puma or unicorn or passenger? apache or nginx? restarting the process depends more on that than anything.
personally, I like using Passenger with apache and when I restart apache, the passenger process restarts automatically.
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.
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.
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.
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/