Can't seems to get rails app running with Passenger

Need help with deploying rails on Passenger in running on Apache.

I am new to Ruby on Rails and deployment. What I have done so far is
successfully installed Passenger into Apache 2.3 on my laptop. Followed
the Passenger user guide and passenger-memory-stats command is running.
I copied my rails application to: /var/www/html/accounts, did a chown to
root.

In /etc/httpd/conf/httpd.conf, there is a line at the end where I
included my virtual host and rails app setup:
Include conf/rails.conf

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

on typing the URL in FF browser, http://fcore/accounts/public and
clicking on: About your application’s environment link, I get

The requested URL /accounts/public/rails/info/properties was not found
on this server.

Actually, am not sure how this whole thing works. During my application
development, I could do script/server and do a URL on FF
http://localhost:3000/accounts/items to see the rails app output. How do
I get to see the my rails app output with Passenger on Apache?

Thanks,
–kmhui

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

Thanks,
–kmhui

Try pointing your DocumentRoot at /var/www/html/accounts/public.

I’m no Apache expert, but if the changing the DocumentRoot doesn’t work,
try commenting out the Directory directive to make sure the Order
deny.allow isn’t interfering.

HTH,

Jim

JA Coulter wrote:

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

Thanks,
–kmhui

Try pointing your DocumentRoot at /var/www/html/accounts/public.

I’m no Apache expert, but if the changing the DocumentRoot doesn’t work,
try commenting out the Directory directive to make sure the Order
deny.allow isn’t interfering.

HTH,

Jim

Thanks Jim for helping.

I tried it but it didn’t work. Changed the DocumentRoot, comment out the
Directory directive. Somehow, rails still isn’t working. Either the
rails framework or the routing is not work. Am beginning to wonder if
its something to do with Apache config, but am not sure what needs to be
changed cos I already followed Passenger’s apache config instructions.

My httpd errorlog shows:

[Wed May 06 04:59:54 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.6
Phusion_Passenger/2.2.2 configured – resuming normal operations
[Wed May 06 04:59:58 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

When I point to /var/www/html/accounts/public, index.html could render
but the application environment link shows

“The requested URL /accounts/public/rails/info/properties was not found
on this server.”

I tried script/server in the rails apps at /var/www/html/accounts and
the application environment link worked. It’s running mongrel though.

Km Hui wrote:

JA Coulter wrote:

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

Thanks,
–kmhui

Try pointing your DocumentRoot at /var/www/html/accounts/public.

I’m no Apache expert, but if the changing the DocumentRoot doesn’t work,
try commenting out the Directory directive to make sure the Order
deny.allow isn’t interfering.

HTH,

Jim

Thanks Jim for helping.

I tried it but it didn’t work. Changed the DocumentRoot, comment out the
Directory directive. Somehow, rails still isn’t working. Either the
rails framework or the routing is not work. Am beginning to wonder if
its something to do with Apache config, but am not sure what needs to be
changed cos I already followed Passenger’s apache config instructions.

My httpd errorlog shows:

[Wed May 06 04:59:54 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.6
Phusion_Passenger/2.2.2 configured – resuming normal operations
[Wed May 06 04:59:58 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

When I point to /var/www/html/accounts/public, index.html could render
but the application environment link shows

“The requested URL /accounts/public/rails/info/properties was not found
on this server.”

I tried script/server in the rails apps at /var/www/html/accounts and
the application environment link worked. It’s running mongrel though.

This is my virtual host configuration for Apache2 with Passenger
installed on my pre-deployment server:

<VirtualHost *:8090>

DocumentRoot /home/emeraldsails/www/current/emerald/public

Options FollowSymLinks
AllowOverride None

My site works fine with this - as you can see it’s pretty basic.

If you haven’t done so already, try commenting out:

RailsBaseURI /acct
RailsEnv production

I’m unfamiliar with the RailsBaseURI directive - if commenting it out
works you may not need it.

Cheers,

Jim

JA Coulter wrote:

Km Hui wrote:

JA Coulter wrote:

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

Thanks,
–kmhui

Try pointing your DocumentRoot at /var/www/html/accounts/public.

I’m no Apache expert, but if the changing the DocumentRoot doesn’t work,
try commenting out the Directory directive to make sure the Order
deny.allow isn’t interfering.

HTH,

Jim

Thanks Jim for helping.

I tried it but it didn’t work. Changed the DocumentRoot, comment out the
Directory directive. Somehow, rails still isn’t working. Either the
rails framework or the routing is not work. Am beginning to wonder if
its something to do with Apache config, but am not sure what needs to be
changed cos I already followed Passenger’s apache config instructions.

My httpd errorlog shows:

[Wed May 06 04:59:54 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.6
Phusion_Passenger/2.2.2 configured – resuming normal operations
[Wed May 06 04:59:58 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

When I point to /var/www/html/accounts/public, index.html could render
but the application environment link shows

“The requested URL /accounts/public/rails/info/properties was not found
on this server.”

I tried script/server in the rails apps at /var/www/html/accounts and
the application environment link worked. It’s running mongrel though.

This is my virtual host configuration for Apache2 with Passenger
installed on my pre-deployment server:

<VirtualHost *:8090>

DocumentRoot /home/emeraldsails/www/current/emerald/public

Options FollowSymLinks
AllowOverride None

My site works fine with this - as you can see it’s pretty basic.

If you haven’t done so already, try commenting out:

RailsBaseURI /acct
RailsEnv production

I’m unfamiliar with the RailsBaseURI directive - if commenting it out
works you may not need it.

Cheers,

Jim

Jim,

Simplified it as you suggested, but didn’t work. Some questions about
your configuration:

DocumentRoot /home/emeraldsails/www/current/emerald/public

  1. What ownership or permission do you have for the DocumentRoot? I
    tried mine with as well as chown to apache but didn’t work.

  2. Did you also do anything to your httpd.conf file?

In my error log, it shows

[Wed May 06 08:04:18 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/accounts/items
[Wed May 06 08:04:25
[Wed May 06 08:04:25 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

Seems as if its not translated (route.rb…) and Apache was actually
looking for ‘items’ in the document root.
With script/server, http://localhost:3000/items works.

Hi Km HUI,

Try change the above:
RailsBaseURI /acct
to
RailsBaseURI /accounts

In my newer server I have set like this:

ServerName myrails DocumentRoot /var/www/myrails/public LogFormat "%t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" myrails CustomLog /var/log/apache2/meurails.log myrails RailsEnv development RailsBaseUri /myrails

You will only change the RailsEnv if you made the necessary changes
under config/environments files to run like production or test.

I hope this can help you!
Look for more information at
http://wiki.rubyonrails.org/deployment/apache-passenger

Regards,
Felippe Silvestre

Km Hui wrote:

JA Coulter wrote:

Km Hui wrote:

JA Coulter wrote:

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

Thanks,
–kmhui

Try pointing your DocumentRoot at /var/www/html/accounts/public.

I’m no Apache expert, but if the changing the DocumentRoot doesn’t work,
try commenting out the Directory directive to make sure the Order
deny.allow isn’t interfering.

HTH,

Jim

Thanks Jim for helping.

I tried it but it didn’t work. Changed the DocumentRoot, comment out the
Directory directive. Somehow, rails still isn’t working. Either the
rails framework or the routing is not work. Am beginning to wonder if
its something to do with Apache config, but am not sure what needs to be
changed cos I already followed Passenger’s apache config instructions.

My httpd errorlog shows:

[Wed May 06 04:59:54 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.6
Phusion_Passenger/2.2.2 configured – resuming normal operations
[Wed May 06 04:59:58 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

When I point to /var/www/html/accounts/public, index.html could render
but the application environment link shows

“The requested URL /accounts/public/rails/info/properties was not found
on this server.”

I tried script/server in the rails apps at /var/www/html/accounts and
the application environment link worked. It’s running mongrel though.

This is my virtual host configuration for Apache2 with Passenger
installed on my pre-deployment server:

<VirtualHost *:8090>

DocumentRoot /home/emeraldsails/www/current/emerald/public

Options FollowSymLinks
AllowOverride None

My site works fine with this - as you can see it’s pretty basic.

If you haven’t done so already, try commenting out:

RailsBaseURI /acct
RailsEnv production

I’m unfamiliar with the RailsBaseURI directive - if commenting it out
works you may not need it.

Cheers,

Jim

Jim,

Simplified it as you suggested, but didn’t work. Some questions about
your configuration:

DocumentRoot /home/emeraldsails/www/current/emerald/public

  1. What ownership or permission do you have for the DocumentRoot? I
    tried mine with as well as chown to apache but didn’t work.

  2. Did you also do anything to your httpd.conf file?

In my error log, it shows

[Wed May 06 08:04:18 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/accounts/items
[Wed May 06 08:04:25
[Wed May 06 08:04:25 2009] [error] [client 127.0.0.1] File does not
exist: /var/www/html/items

Seems as if its not translated (route.rb…) and Apache was actually
looking for ‘items’ in the document root.
With script/server, http://localhost:3000/items works.

Hi Km Hui,

have you solved the issue, if not try this

1.) Add the passenger module in the /etc/httpd/conf/httpd.conf itself,
just before the # Include the virtual host configurations line.

2.) in the virtual host file just add these things this will make your
app work

<VirtualHost *:80>
ServerName fcore

ServerAlias

DocumentRoot “/var/www/html/accounts/public”
RailsEnv production
RailsMaxPoolSize 2

<Directory “/var/www/html/accounts/public”>
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
Allow from all

try these steps and revert if you find any errors.

Rgds
TML

Km Hui,

The main thing you have to note here is that the “properties” listing
will not be done for an external request or for the production
environemt.So you will not be able to see it using apache or any web
server.You can just view properties using the script/server.

You needn’t set RailsBaseURI as your apps will be by default handled by
mod_rails.Did you do that for any apps in the public floder?If so thats
fine then.And you need not set RailsEnv to production as by default
mod_rails fires the apps on the production env.

Thanks,
Kilari.
http://kilari.co.in

Km Hui wrote:

Need help with deploying rails on Passenger in running on Apache.

I am new to Ruby on Rails and deployment. What I have done so far is
successfully installed Passenger into Apache 2.3 on my laptop. Followed
the Passenger user guide and passenger-memory-stats command is running.
I copied my rails application to: /var/www/html/accounts, did a chown to
root.

In /etc/httpd/conf/httpd.conf, there is a line at the end where I
included my virtual host and rails app setup:
Include conf/rails.conf

Here is the details of rails.conf

LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
ServerName fcore
DocumentRoot /var/www/html/accounts
RailsBaseURI /acct
RailsEnv production

<Directory “/var/www/html/accounts”>
Options -Indexes +FollowSymLinks
Order deny,allow
Allow from all

on typing the URL in FF browser, http://fcore/accounts/public and
clicking on: About your application’s environment link, I get

The requested URL /accounts/public/rails/info/properties was not found
on this server.

Actually, am not sure how this whole thing works. During my application
development, I could do script/server and do a URL on FF
http://localhost:3000/accounts/items to see the rails app output. How do
I get to see the my rails app output with Passenger on Apache?

Thanks,
–kmhui

Thanks Kilari. Will give it a try.

regards,
–kmhui