Reputation: 329
I have a CentOS 6 server, with cPanel, Apache, Passenger, Ruby, and Rails installed.
My websites are hosted using cPanel.
When I go to mysite.org/mysuburi
, I get the directory listing of the public directory of the rails app (/myrailsapp/public), instead of the rails app itself.
Here is my /usr/local/apache/conf/httpd.conf:
<VirtualHost my.ip.add.ress:80>
ServerName mysite.org
ServerAlias www.mysite.org
DocumentRoot /home/mysite/public_html
ServerAdmin [email protected]
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/mysite.org combined
<IfModule log_config_module>
<IfModule logio_module>
CustomLog /usr/local/apache/domlogs/mysite.org-bytes_log "%{%s}t %I .\n%{%s}t %O ."
</IfModule>
</IfModule>
## User mysite # Needed for Cpanel::ApacheConf
<IfModule userdir_module>
<IfModule !mpm_itk.c>
<IfModule !ruid2_module>
UserDir enabled mysite
</IfModule>
</IfModule>
</IfModule>
# Enable backwards compatible Server Side Include expression parser for Apache versions >= 2.4.
# To selectively use the newer Apache 2.4 expression parser, disable SSILegacyExprParser in
# the user's .htaccess file. For more information, please read:
# http://httpd.apache.org/docs/2.4/mod/mod_include.html#ssilegacyexprparser
<IfModule include_module>
<Directory "/home/mysite/public_html">
SSILegacyExprParser On
</Directory>
</IfModule>
<IfModule suphp_module>
suPHP_UserGroup mysite mysite
</IfModule>
<IfModule concurrent_php.c>
php4_admin_value open_basedir "/home/mysite:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
php5_admin_value open_basedir "/home/mysite:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule !concurrent_php.c>
<IfModule mod_php4.c>
php_admin_value open_basedir "/home/mysite:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir "/home/mysite:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule sapi_apache2.c>
php_admin_value open_basedir "/home/mysite:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
</IfModule>
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup mysite mysite
</IfModule>
</IfModule>
<IfModule ruid2_module>
RMode config
RUidGid mysite mysite
</IfModule>
<IfModule mpm_itk.c>
# For more information on MPM ITK, please read:
# http://mpm-itk.sesse.net/
AssignUserID mysite mysite
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ /home/mysite/public_html/cgi-bin/
</IfModule>
Include "/usr/local/apache/conf/userdata/std/2_4/mysite/mysite.org/*.conf"
</VirtualHost>
(Notice the last line in the main block, denoting more configuration)
My /usr/local/apache/conf/userdata/std/2_4/mysite/mysite.org/rails.conf:
RailsEnv development
RackEnv development
<Directory /home/mysite/rails_apps/myrailsapp/public>
Options -MultiViews +FollowSymLinks
</Directory>
RailsBaseURI /mysuburi
Alias /mysuburi /home/mysite/rails_apps/myrailsapp/public
<Location /mysuburi>
PassengerBaseURI /mysuburi
PassengerAppRoot /home/mysite/rails_apps/myrailsapp
</Location>
<Directory /home/mysite/rails_apps/myrailsapp/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
PassengerResolveSymlinksInDocumentRoot on
My /usr/local/apache/conf/includes/pre_main_global.conf:
Include "/usr/local/apache/conf/passenger.conf"
My /usr/local/apache/conf/passenger.conf:
LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.21/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.21
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
Output of ruby -v; rails -v; passenger -v
:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
Rails 4.2.4
Phusion Passenger version 5.0.21
I have also symlinked the public directory of my app to a subfolder in my public_html folder as follows:
/home/mysite/rails_apps/myrailsapp/public /home/mysite/public_html/mysuburi
Output of passenger-status
:
----------- General information -----------
Max pool size : 6
App groups : 0
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
I'm at my wit's end... can anybody help me solve this head-scratcher?
UPDATE: Had two versions of passenger installed. I uninstalled both and reinstalled 5.0.21, then updated the passenger.conf file. Still having the same issue, with the same configuration and output.
Upvotes: 2
Views: 520
Reputation: 329
I don't know why, but it randomly started working. I had opened a support ticket with MediaTemple (the provider of my server) giving all these details, and the next day it was working. I have received no feedback, so I don't know what was done. I asked them what they did to fix it, and if they tell me, I'll post it here.
Upvotes: 0
Reputation: 1723
I had the same issue. I found this answer on serverfault which saved my day: https://serverfault.com/questions/731814/apachepassenger-not-serving-the-root-of-the-sinatra-application
He suggested to disable the load of the autoindex_module due to a bug in Apache 2.4.17 in combination with Passenger, which worked for me.
Upvotes: 0