Marco Sero
Marco Sero

Reputation: 460

Apache with Passenger doesn't load Rails app

I'm developing a Rails app and am trying to configure the web server it's deployed on. My problem is that the page doesn't load.

In Apache's error.log there are no errors and in my app's log/production.log only the line(s) Connecting to database specified by database.yml appears.

I have no index.html in app's public folder and the application works fine in the development environment.

I'm using an Amazon instance with Ubuntu 12.04 and I've installed ruby through RVM. In my httpd.conf I have:

LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17
PassengerRuby /home/ubuntu/.rvm/wrappers/ruby-1.9.3-p194/ruby

Apache starts without errors.

Below there is my sites-available/default:

# other virtualhosts
#

<VirtualHost *:80>
    ServerName my_app.mydomain.com
    ServerAdmin [email protected]

    DocumentRoot /home/ubuntu/public_html/my_app/current/public

    <Directory /home/ubuntu/public_html/my_app/current/public>
        Allow from all
        Options -MultiViews
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>

What should I do now to get passenger working?

Upvotes: 3

Views: 1743

Answers (2)

Alejo Dev
Alejo Dev

Reputation: 2576

I had this same problem the answer was in the unicorn.log file. It was a syntax error in a controller. You should look in the passenger log file

Upvotes: 0

Marco Sero
Marco Sero

Reputation: 460

I decided to reinstall Ruby and all the other stuff and moving to nginx. Finally now I have all working (both in ngnix and apache). This is what I've done, if someone cares:

Ruby + Rails

Install ruby + rails via RVM

curl -L https://get.rvm.io | bash -s stable --rails

Load rvm in all opened shells

source ~/.rvm/scripts/rvm

Install gem

gem install passenger

apache

Install apache and passenger module

rvmsudo passenger-install-apache2-module

Copy these lines to /etc/apache2/httpd.conf

LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17
PassengerRuby /home/ubuntu/.rvm/wrappers/ruby-1.9.3-p194/ruby

nginx

Install nginx and passenger module

rvmsudo passenger-install-nginx-module

Copy these lines to /opt/nginx/conf/nginx.conf

passenger_root /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17;
passenger_ruby /home/ubuntu/.rvm/wrappers/ruby-1.9.3-p194/ruby;

Setup a script to allow you to control Nginx

wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults

You can now control Nginx with this script

sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start

Final setup with nodejs

One of the other things you’ll want is Node.js. This will help you do the compiling of assets on deployments

sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get -y update
sudo apt-get -y install nodejs

Upvotes: 2

Related Questions