How to start a Rails server forever on Ubuntu - ruby-on-rails

I have uploaded my Rails app on my Ubuntu server, where I want to keep my Rails server running so that any one can access it at any time.
I tried the command below to run my app:
rails server --binding=oditek.in -p 8888
Please help me to make this possible.

You can try following option to run the server in background.
rails s -d ## With default Port.
rails s -p 8888 -d ## With Custom port.
Or
nohup rails s &
Or
You can also configure your project with Nginx + Passenger

Related

Ruby on Rails => Server is sleeping before some time

I have installed Redmine on my computer, i can run it with the command:
bundle exec rails server webrick -e production
And that's working good
But it's just for work with localhost.
I need to access to Redmine from another station. For this, i have found this command:
rails s -p 3000 -b 0.0.0.0
And that's working good, but in this case, after some time without query, the rail server turn in sleep.
And if i clic in redmine, the server don't response. I have to enter in console and press a key for wake up it.
That's working with
bundle exec rails server webrick -p3000 -b 0.0.0.0 -e production
Thanks to MAX for telling me that WebRick was a webserver

How to run Rails server on different ports with address on Ubuntu

I want to run my Rails server on different ports with different addresses. I need to run it on port 8888 and address 10.XX.XX.XXX for all time, in other words, once I start the server, it should run until the server is not stop [sic]. I am running this on Ubuntu machine. Please help me resolve this problem.
Try this:
rails s -p 8888 -b 10:xx:xx:xx
And if you want to run the server in background, then use
rails s -p 8888 -b 10:xx:xx:xx -D
You could try to run it on rails s -p 8888 and it will be available on your server address on port xxx.xx.xxx.xx:8888

How to start rails server on some other port?

I want to start rails sever on port other that 3000 so that I can run two applications simultaneously on my machine. One is running on server using port 3000 and 2nd with new port.
Use the -p option:
rails server -p 3001
rails s -p <port_number>

passenger start standalone with RAILS_ENV=production

I'm trying to run multiple rails apps (different versions) on my server. I followed this post
Phusion Passenger & running multiple Ruby versions
I ran one app outside the pattern with passenger standalone:
passenger start -a 127.0.0.1 -p 3000 -d
But I got this error:
database configuration does not specify adapter
(ActiveRecord::AdapterNotSpecified)
So, this app is on the development environment and I want to run as production mode.
How can I do it?
Solved! I passed now this command:
passenger start -a 127.0.0.1 -p 3000 -d --environment production

Alternate command for passenger start

I have changed my Apache2 port from 80 to 3001
now when i start my rails app i use
rvmsudo rails server -p 80
but I want to run my rails app in passenger nginx that I have already installed. i tried the following but not working
1. rvmsudo passenger start -a 127.0.0.1 -p 80 -e development
2. rvmsudo passenger start -p 80
3. sudo passenger start -e development -p 80
So please let me know what the exact thing i have to do to run my app on port 80 using passenger Thnaks in Advance!
You should use Phusion Passenger's Nginx integration mode. The passenger command only gives you access to the Standalone mode. For more information about the differences between the Nginx integration mode and the Standalone mode, see http://www.modrails.com/documentation/Users%20guide.html.

Resources