Forum: Rails deployment Can't seems to get rails app running with Passenger

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Km H. (Guest)
on 2009-05-04 17:01
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
  </Directory>

</VirtualHost>

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
JA C. (Guest)
on 2009-05-05 20:53
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
>   </Directory>
>
> </VirtualHost>
>

>
> 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
Km H. (Guest)
on 2009-05-06 01:16
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
>>   </Directory>
>>
>> </VirtualHost>
>>
>
>>
>> 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.
JA C. (Guest)
on 2009-05-06 02:49
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
>>>   </Directory>
>>>
>>> </VirtualHost>
>>>
>>
>>>
>>> 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
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

</VirtualHost>

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
Km H. (Guest)
on 2009-05-06 04:12
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
>>>>   </Directory>
>>>>
>>>> </VirtualHost>
>>>>
>>>
>>>>
>>>> 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
>   <Directory />
>     Options FollowSymLinks
>     AllowOverride None
>   </Directory>
>
> </VirtualHost>
>
> 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 <user> 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.
Felippe S. (Guest)
on 2009-06-20 09:34
Hi Km HUI,

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

In my newer server I have set like this:

<VirtualHost myrails>
        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
</VirtualHost>

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
Mahalingam M. (Guest)
on 2009-06-29 10:22
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
>>>>>   </Directory>
>>>>>
>>>>> </VirtualHost>
>>>>>
>>>>
>>>>>
>>>>> 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
>>   <Directory />
>>     Options FollowSymLinks
>>     AllowOverride None
>>   </Directory>
>>
>> </VirtualHost>
>>
>> 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 <user> 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
  </Directory>
</VirtualHost>

try these steps and revert if you find any errors.

Rgds
TML
Vamsi krishna K. (Guest)
on 2009-07-07 15:17
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
>   </Directory>
>
> </VirtualHost>
>
> 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 H. (Guest)
on 2009-07-09 01:19
Thanks Kilari. Will give it a try.

regards,
--kmhui
This topic is locked and can not be replied to.