问题
I'm trying to get my rails app to run in production mode but I've been having a bit of difficulty.
I'm using passenger with apache and am running Ubuntu 12.04. I have my production database configured and created, and passenger set up. Status is as follows:
$ rvmsudo passenger-status
Version : 4.0.56
Date : 2014-12-25 01:54:20 +0000
Instance: 7264
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
However when I run rails server -e production
, it still listens on port 3000 see below:
$ rails server -e production
=> Booting WEBrick
=> Rails 4.2.0 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-12-25 01:54:49] INFO WEBrick 1.3.1
[2014-12-25 01:54:49] INFO ruby 2.1.5 (2014-11-13) [i686-linux]
[2014-12-25 01:54:49] INFO WEBrick::HTTPServer#start: pid=7459 port=3000
What might I be missing to get it to listens on port 80 in production mode?
Many thanks in advance.
回答1:
I don't think this is how you have to start the server in production using Apache. Did you install apache-paassenger modules? and made changes in apache conf file?
First, the gem needs to be installed on the system:
gem install passenger
Before the Apache module is compiled, two dependency packages need to be installed as well:
apt-get install curl-devel httpd-devel
Use this command to start the apache installation: It will take some time
passenger-install-apache2-module
Passenger will display some content after Apache
installs:
Follow it up and make changes in (/etc/httpd/conf/httpd.conf)
You will have to point to application public folder and restart the apache server follow with these sources closely.
https://www.digitalocean.com/community/tutorials/how-to-install-rails-apache-and-mysql-on-ubuntu-with-passenger
https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6
It helped when I did it for first time.
来源:https://stackoverflow.com/questions/27644070/getting-rails-production-to-run-on-port-80