For some reason, Apache doesn't seem to like my Rails App, running on Google Compute Engine with Phusion Passenger (using WEBrick, for now). I'm running this on Google's "Click-to-Deploy" ruby instance, which runs on Debian. I've also updated Ruby to 2.2.2 and set rvm use global 2.2.2
.
I go and rails s
and start up the server, go to the IP address, and get a lovely 500 Internal Error
from Apache saying my server configuration is all sorts of messed up. If i try going to <ip_address>:3000
I get no response from the server.
The configuration file (in /etc/apache2/sites-available/
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/nick/qwestera
RailsEnv production
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/home/nick/qwestera">
Options FollowSymLinks
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The logs (errors repeat):
[ 2015-07-31 18:46:36.9094 8146/7f0809eaa720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Fri Jul 31 18:46:36 2015] [notice] Apache/2.2.22 (Debian) Phusion_Passenger/4.0.58 configured -- resuming normal operations
[Fri Jul 31 18:46:48 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:46:49 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:46:58 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:46:59 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:47:02 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:47:02 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:47:17 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:47:17 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:47:17 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:47:19 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:47:19 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:48:08 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:48:08 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:55:23 2015] [notice] caught SIGTERM, shutting down
[ 2015-07-31 18:55:24.5305 3807/7f317e333720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58', 'passenger_version' => '4.0.58', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.58', 'web_server_pid' => '5755', 'web_server_type' => 'apache', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
[ 2015-07-31 18:55:24.5352 3810/7fb4d8c13720 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.3806/generation-0/request
[ 2015-07-31 18:55:24.5413 3816/7f854bdf8740 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.3806/generation-0/logging
[ 2015-07-31 18:55:24.5416 3807/7f317e333720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[ 2015-07-31 18:55:24.5609 3832/7f94e6c6b720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '$
[ 2015-07-31 18:55:24.5669 3840/7f6a6a654720 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.3827/generation-0/request
[ 2015-07-31 18:55:24.5730 3853/7f5623e51740 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.3827/generation-0/logging
[ 2015-07-31 18:55:24.5733 3832/7f94e6c6b720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Fri Jul 31 18:55:24 2015] [notice] Apache/2.2.22 (Debian) Phusion_Passenger/4.0.58 configured -- resuming normal operations
[Fri Jul 31 18:55:54 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:55:54 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:55:59 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:55:59 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:56:01 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:56:01 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:56:46 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:56:46 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:56:49 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:56:49 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:58:37 2015] [notice] caught SIGTERM, shutting down
[ 2015-07-31 18:58:38.3388 4200/7f8f1041b720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '$
[ 2015-07-31 18:58:38.3434 4203/7fe96b315720 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4199/generation-0/request
[ 2015-07-31 18:58:38.3489 4209/7fe051b12740 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4199/generation-0/logging
[ 2015-07-31 18:58:38.3491 4200/7f8f1041b720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[ 2015-07-31 18:58:38.3672 4225/7fcc75d26720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '$
[ 2015-07-31 18:58:38.3725 4233/7f79a2e4c720 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.4220/generation-0/request
[ 2015-07-31 18:58:38.3790 4244/7f0bef1b9740 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.4220/generation-0/logging
[ 2015-07-31 18:58:38.3792 4225/7fcc75d26720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Fri Jul 31 18:58:38 2015] [notice] Apache/2.2.22 (Debian) Phusion_Passenger/4.0.58 configured -- resuming normal operations
[Fri Jul 31 18:58:50 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:58:50 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
[Fri Jul 31 18:58:53 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /
[Fri Jul 31 18:58:53 2015] [crit] [client 98.117.13.138] configuration error: couldn't perform authentication. AuthType not set!: /favicon.ico, referer: http://130.211.115.98/
A log entry I think may give me some insight:
[Fri Jul 31 18:55:23 2015] [notice] caught SIGTERM, shutting down
[ 2015-07-31 18:55:24.5305 3807/7f317e333720 agents/Watchdog/Main.cpp:538 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58', 'passenger_version' => '4.0.58', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.58', 'web_server_pid' => '5755', 'web_server_type' => 'apache', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
Specifically:
'default_ruby' => '/usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby',
'passenger_root' => '/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58'
If you'll notice, I said I updated ruby to 2.2.2
because that's what the project I'm trying to run uses. However, Apache has default_ruby
and passenger_root
directories including ruby 2.1.1
. Would this be the issue? If so, how would I change this?
UPDATE:
Removing Require all granted
has gotten me one step closer (this line is only necessary for version of Apache greater than 2.4, which mine is 2.2).
Now I'm getting a passenger page (with my rails app's favicon.ico showing up, yay!), letting me know Web application could not be started
.
It has shown me the following errors:
Your Ruby version is 2.1.1, but your Gemfile specified 2.2.2 (Bundler::RubyVersionMismatch)
/usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/definition.rb:390:in `validate_ruby!'
/usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler.rb:115:in `setup'
/usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/lib/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/lib/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/lib/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:100:in `preload_app'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:28:in `<main>'
Breakdown: I totally called that it was a Ruby version issue! Now, how do I let passenger know to look for stuff in the new Ruby dir for 2.2.2?
Interesting and possibly insightful:
$ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
$ ruby -version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)
ruby -version
returns a NameError
, but ruby --version
does not. Wtf?
UPDATE 2:
Well, I've updated /etc/apache2/apache2.conf to point to the new directory. However, my rails application isn't actually running. I just see an index of all the files and folders in my application. How do I tell it to start?
Solved by uninstalling old version of Ruby with rvm uninstall 2.1.1
, reinstalling new version with rvm install 2.2.2
, then installing passenger again using passenger-install-apache2-module
.