0

I've been trying for days to get a rails app to run under Passenger on Bluehost, but with no luck. Going to my subdomain where I'm hoping this will run, I'm only getting a directory listing with cgi-bin and public subdirectories. No execution of the rails app.

httpd.conf includes:

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.6/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.6
  PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.1/wrappers/ruby
</IfModule>

and

<VirtualHost 162.144.138.43:80>
  ServerName secure.xxxxx.com
  ServerAlias www.secure.xxxxx.com
  DocumentRoot /home/diamoou1/public_html/securefinance
  ServerAdmin webmaster@secure.xxxxx.com
  UseCanonicalName Off
  CustomLog /usr/local/apache/domlogs/secure.xxxxx.com combined
  CustomLog /usr/local/apache/domlogs/secure.xxxxx.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
  ## User diamoou1 # Needed for Cpanel::ApacheConf
  UserDir enabled diamoou1
  <IfModule mod_suphp.c>
    suPHP_UserGroup diamoou1 diamoou1
  </IfModule>
  <IfModule !mod_disable_suexec.c>
    <IfModule !mod_ruid2.c>
        SuexecUserGroup diamoou1 diamoou1
    </IfModule>
  </IfModule>
  <IfModule mod_ruid2.c>
      RUidGid diamoou1 diamoou1
  </IfModule>
  ScriptAlias /cgi-bin/ /home/diamoou1/public_html/securefinance/cgi-bin/

  <Directory /home/diamoou1/public_html/securefinance>
    Options -MultiViews
    AllowOverride All
  </Directory>

</VirtualHost>

In /home/diamoou1/public_html/securefinance/public I have the .htaccess file:

<IfModule mod_passenger.c>
  Allow from all
  Order Deny,Allow
  Options +FollowSymLinks -SymLinksIfOwnerMatch -MultiViews
  PassengerResolveSymlinksInDocumentRoot on
  #Set this to whatever environment you'll be running in
  RailsEnv production
  RackBaseURI /
  SetEnv GEM_HOME /home/diamoou1/ruby/gems
</IfModule>

Temporarily putting a bad line in the .htaccess file will give the expected error in the log, so apparently apache is reading the .htaccess file.

I suspect the problem might be in RackBaseURI. I installed Passenger as root. RackBaseURI resolves to /root and there is a /root/public_html directory, although apache is serving up the /home/diamoou1/public_html/securefinance directory (where the rails app actually resides). I don't know how to change that variable or it that's really the problem. PassengerBaseURI is the same.

What do I do to fix this?????

mpipkorn
  • 153
  • 2
  • 9
  • I can suggest helpful debugging method that may give a few hints about what is/isn't working in your middleware stack (incl. racking). Run this on your production machine: "rake middleware RAILS_ENV=production". I found it useful to help track down why my app wasn't being loaded. – Elvn Apr 20 '15 at 22:03
  • Thanks for the suggestion, but that yields a list of settings in which I can't find any hints. The list is pretty much identical to the result when I run the same command on another app on another machine that is working properly. The only difference is one line: "use Rack::Lock" vs "use ActionDispatch::Static" – mpipkorn Apr 20 '15 at 23:18
  • "The only difference is one line: "use Rack::Lock" vs "use ActionDispatch::Static" Now you have a starting point . Focus there. – Elvn Apr 20 '15 at 23:35
  • Unfortunately that's not much of a starting point. use Rack::Lock just sets the multi-thread flag and wraps the app in a Mutex. ActionDispatch::Static is for serving static files. Neither explains why rails is not running at all. – mpipkorn Apr 21 '15 at 13:16
  • Then it's not in the middleware. You may not get an answer tied in a bow, you may have to hammer through eliminating potential sources of the problem one at a time. I do wish you luck. – Elvn Apr 21 '15 at 13:22

1 Answers1

0

This may help you : https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_tutorial_example_writing_and_deploying_a_hello_world_rack_application

Here is the example configuration provided by Phusion Passenger :

<VirtualHost *:80>
    ServerName www.rackexample.com
    DocumentRoot /webapps/rack_example/public
    <Directory /webapps/rack_example/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>
</VirtualHost>

DocumentRoot and Directory should point to the public folder of your rails application not the root.

You should change :

...
DocumentRoot /home/diamoou1/public_html/securefinance
...
<Directory /home/diamoou1/public_html/securefinance>
...

to :

...
DocumentRoot /home/diamoou1/public_html/securefinance/public
...
<Directory /home/diamoou1/public_html/securefinance/public>
...
Maurice Qch
  • 166
  • 1
  • 4