Passenger Nginx Rails in debian 7 not working

VK13 asked:

I have installed Phusion passenger following official document :

https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu

Following Steps are performed:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates
sudo touch /etc/apt/sources.list.d/passenger.list
sudo vi /etc/apt/sources.list.d/passenger.list

Added this:

deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main

And then

sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
sudo apt-get update

sudo apt-get install nginx-extras passenger -y

copied path returned by /usr/bin/passenger-config --root
and appended passenger_root in /etc/nginx/nginx.conf

sudo service nginx restart
sudo gem install passenger
sudo passenger-install-nginx-module

sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults

Then restarted nginx.

I have my rails app in /opt/www/app.co/app(deployed using mina). And have added app.co in /etc/nginx/sites-available with symbolic link in sites-enabled, and configured server block (/etc/nginx/sites-available/app.co) like:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    root /opt/www/app.co/app/public;
    passenger_enabled on;
    server_name localhost;
}

/opt/nginx/conf/nginx.conf looks like this:
>

worker_processes 1;
events {
worker_connections 1024;
}

http {
passenger_root /var/lib/gems/1.91./gems/passenger-4.0.53;
passenger_ruby /home/deployer/.rvm/rubies/ruby-2.1.5/bin/ruby;
include mime_types;
default_type application/octet-stream;
sendfile on;
keepalive-timeout 65;

server {
             listen 80;
             server_name localhost;
             root /opt/www/app.co/app/public;
             passenger_enabled on; 
      }
  }

Inspite of these configurations, always default nginx page is loading

Have tried to edit nginx default page located in

/opt/nginx/html/index.html /usr/share/nginx/www/index.html>

But no difference, always default page.

sudo passenger-status shows:

Version : 4.0.53
Date : 2014-12-11 04:43:20 -0600
Instance: 22618
———– General information ———–
Max pool size : 6
Processes : 0
Requests in top-level queue : 0

———– Application groups ———–

sudo passenger-memory-stats shows:

————- Apache processes ————-
WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your ‘apxs2’ executable’s filename, or set
the HTTPD environment variable to your ‘httpd’ or ‘apache2’ executable’s filename.

———- Nginx processes ———–
PID PPID VMSize Private Name
————————————–
22618 1 112.0 MB 0.2 MB nginx: master process /usr/sbin/nginx
22620 22618 112.3 MB 0.5 MB nginx: worker process
22621 22618 112.3 MB 0.5 MB nginx: worker process
22623 22618 112.3 MB 0.5 MB nginx: worker process
22624 22618 112.3 MB 0.5 MB nginx: worker process
Processes: 5
Total private dirty RSS: 2.09 MB

—– Passenger processes —–
PID VMSize Private Name
——————————-
22600 25.6 MB 0.3 MB PassengerWatchdog
22603 109.3 MB 0.3 MB PassengerHelperAgent
22612 145.0 MB 0.9 MB PassengerLoggingAgent
Processes: 3
Total private dirty RSS: 1.54 MB

Stopped nginx with:
sudo service nginx stop

But still default page. Am i missing anything here ?!

Please lend me some inputs how to correct this issue and configure my rails app.

My answer:


The root should be pointed at your Rails app’s public directory, not its app directory.

    root /opt/www/app.co/public;

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.