Fedora + Apache + Phusion passenger + Rails shows default apache page (always) - ruby-on-rails

Even though there is a huge amount of information about this subject I'm still stuck at the apache default page shown by the server. The worse part is that everything seems to work properly.
I've installed everything using dnf, even the ruby gems
I'm using
Fedora 22 Server minimal installation 4.2.6-200.fc22.x86_64
Apache 2.4.17
Phusion passenger 4.0.53
Packages that I've installed
# dnf install nodejs ruby rubygem-rails ruby-devel rubygem-json rubygem-debug_inspector rubygem-byebug rubygem-sqlite3 httpd mod_passenger
Passenger config file (edited after #bobomoreno answer)
$ cat /etc/httpd/conf.d/passenger.conf
<IfModule mod_passenger.c>
PassengerRoot /usr/share/passenger//phusion_passenger/locations.ini
PassengerRuby /usr/bin/ruby
PassengerEnable on
<VirtualHost *:80>
ServerName 10.10.15.219
ServerAdmin los_true#gmail.com
DocumentRoot /var/www/html/los_true/public
ErrorLog /var/log/httpd/tsc-error.log
CustomLog /var/log/httpd/tsc-access.log common
RackEnv development
<Directory /var/www/html/los_true/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
</IfModule>
Firewall working fine
# firewall-cmd --list-all
public (default, active)
interfaces: eth0
sources:
services: dhcpv6-client http https mdns ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
SELinux permissive (until everything else work fine, then I will change it to enforcing)
$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 29
Apache server running without errors
$ systemctl status -l httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since sáb 2015-11-28 20:41:05 CLT; 24min ago
Main PID: 25649 (httpd)
Status: "Total requests: 1; Idle/Busy workers 100/0;Requests/sec: 0.00068; Bytes served/sec: 3 B/sec"
CGroup: /system.slice/httpd.service
├─25649 /usr/sbin/httpd -DFOREGROUND
├─25650 /usr/libexec/nss_pcache 1802248 off /etc/httpd/alias
├─25671 PassengerWatchdog
├─25674 PassengerHelperAgent
├─25679 PassengerLoggingAgent
├─25689 /usr/sbin/httpd -DFOREGROUND
├─25690 /usr/sbin/httpd -DFOREGROUND
├─25691 /usr/sbin/httpd -DFOREGROUND
├─25692 /usr/sbin/httpd -DFOREGROUND
├─25693 /usr/sbin/httpd -DFOREGROUND
└─25705 /usr/sbin/httpd -DFOREGROUND
nov 28 20:41:04 ip210.15.priv.inf.utfsm.cl systemd[1]: Starting The Apache HTTP Server...
nov 28 20:41:05 ip210.15.priv.inf.utfsm.cl systemd[1]: Started The Apache HTTP Server.
Passenger started and running with no errors listed
# cat /var/log/httpd/error_log | grep 'Phusion\|Passenger'
[ 2015-11-28 21:43:34.3687 26203/7f416653f740 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.26198/generation-0/request
[ 2015-11-28 21:43:34.3807 26209/7ff9a135b840 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.26198/generation-0/logging
[ 2015-11-28 21:43:34.3817 26200/7fdd4c2bf740 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[ 2015-11-28 21:43:34.4808 26223/7fb79dc8d740 agents/HelperAgent/Main.cpp:650 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.26198/generation-1/request
[ 2015-11-28 21:43:34.4912 26229/7f643095a840 agents/LoggingAgent/Main.cpp:321 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.26198/generation-1/logging
[ 2015-11-28 21:43:34.4916 26220/7efd30072740 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[Sat Nov 28 21:43:34.498645 2015] [mpm_prefork:notice] [pid 26198] AH00163: Apache/2.4.17 (Fedora) mod_auth_gssapi/1.3.0 mod_nss/2.4.16 NSS/3.19.3 Basic ECC mod_wsgi/4.4.8 Python/2.7.10 Phusion_Passenger/4.0.53 configured -- resuming normal operations
# cat /var/log/httpd/tsc-error.log
#
Rails application working (It was tested in a local machine and it worked fine)
$ cd /var/www/html/los_true
$ ./bin/bundle install
Using rake 10.4.2
Using i18n 0.7.0
...
Using web-console 2.2.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ ./bin/rake db:migrate
$
So I have truly no idea what I'm doing wrong. Also there is only one weird thing about passenger, it says that is not running but it redirects the public folder fine (I can see the *.html files located in the public folder if I put them in the URL, http://10.10.15.219/404.html for example)
$ passenger-status
ERROR: Phusion Passenger doesn't seem to be running.
So please if anyone have any idea of what's the problem in here please help me :c because I really don't know what else to do

Looks like you are missing
passenger_enabled on;
in your virtual host definition

I finally found the problem in this link :'D
It turned out to be the autoindex module the source of evil. If you comment the line
...
LoadModule autoindex_module modules/mod_autoindex.so
...
in /etc/httpd/conf.modules.d/00-base.conf and remove the file autoindex.conf
# mv /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/autoindex.conf.bak
you will get the rail views working :')

Related

nginx permission denied accessing puma socket that does exist in the correct location

On a Digital Ocean droplet running Ubuntu 21.10 impish I am deploying a bare bones Rails 7.0.0.alpha2 application to production. I am setting up nginx as the reverse proxy server to communicate with Puma acting as the Rails server.
I wish to run puma as a service using systemctl without sudo root privileges. To this effect I have a puma service setup in the users home folder located at ~/.config/systemd/user, the service is enabled and runs as I would expect it to run.
systemctl status --user puma_master_cms_production
reports the following
● puma_master_cms_production.service - Puma HTTP Server for master_cms (production)
Loaded: loaded (/home/comtechmaster/.config/systemd/user/puma_master_cms_production.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-11-18 22:31:02 UTC; 1h 18min ago
Main PID: 1577 (ruby)
Tasks: 10 (limit: 2338)
Memory: 125.1M
CPU: 2.873s
CGroup: /user.slice/user-1000.slice/user#1000.service/app.slice/puma_master_cms_production.service
└─1577 puma 5.5.2 (unix:///home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock)
Nov 18 22:31:02 master-cms systemd[749]: Started Puma HTTP Server for master_cms (production).
The rails production.log is empty.
The puma error log shows the following
cat log/puma_error.log
=== puma startup: 2021-11-18 22:31:05 +0000 ===
The pid files exist in the application roots shared/tmp/pids folder
ls tmp/pids
puma.pid puma.state
and the socket that nginx needs but is unable to connect to due to permission denied exists
ls -l ~/apps/master_cms/shared/tmp/sockets/
total 0
srwxrwxrwx 1 comtechmaster comtechmaster 0 Nov 18 22:31 puma_master_cms_production.sock
nginx is up and running and providing a
502 bad gateway
response. The nginx error log reports the following error
2021/11/18 23:18:43 [crit] 1500#1500: *25 connect() to unix:/home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock failed (13: Permission denied) while connecting to upstream, client: 86.160.191.54, server: 159.65.50.229, request: "GET / HTTP/2.0", upstream: "http://unix:/home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock:/500.html"
sudo nginx -t reports the following
sudo nginx -t
nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfu
just to be pedantic both an ls and a sudo ls to the path reported in the error shows
ls /home/comtechmaster/apps/master_cms/shared/tmp/sockets/
puma_master_cms_production.sock
as expected so I am stumped to understand why nginx running as root using sudo service nginx start is being denied access to a socket that exists, that is owned by the local user rather than root.
I expect the solution is going to be something totally obvious but I can not see what
This problem ended up being related to the folder permissions for the users home folder and specifically a change in the way Ububntu 20.10 sets permissions differently to previous versions of ubuntu, or at least a difference in the way the DigitalOcean setup scripts behave.
This was resolved with a simple command line chmod o=rx from the /home against the user folder concerned e.g.
cd /home
chmod o=rx the_home_folder_for_user

Passenger not running (Ruby on Rails + Nginx)

My AWS instance was working fine with my app. But, today, the server was down without memory ram. Then I run:
sync; echo 1 > /proc/sys/vm/drop_caches
sudo service nginx start
After that, ram memory consumption is ok, but the app not.
I'm running a Rails 4.2.1 website with Ruby 2.2.2 and nginx/1.8.0 in a Ubuntu 14 AWS instance.
When I access the site, I have the error:
502 Bad Gateway
nginx/1.8.0
When I run passenger-config restart-app I have:
*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it
is running, then the causes of this problem could be one of:
1. You customized the instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's
passenger_instance_registry_dir option, or Phusion Passenger Standalone's
--instance-registry-dir command line argument. If so, please set the
environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
and run this command again.
2. The instance directory has been removed by an operating system background
service. Please set a different instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
option, or Phusion Passenger Standalone's --instance-registry-dir command
line argument.
In the file /var/log/nginx/error.log I have:
2021/06/19 13:21:12 [crit] 26618#0: *48688773 connect() to unix:/tmp/passenger.26EHXct/agents.s/server failed (2: No such file or directory) while connecting to upstream, client: XXX.XXX.34.163, server: www.XXX.com, request: "GET / HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.26EHXct/agents.s/server:", host: "XXX.com"
I already tried this solution and not working.
When I run: passenger-config validate-install I have:
Use <space> to select.
If the menu doesn't display correctly, press '!'
‣ ⬢ Passenger itself
⬡ Apache
-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
Everything looks good. :-)
When I run: sudo passenger-memory-stats I have:
Version: 5.0.10
Date : 2021-06-19 13:31:40 -0300
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.
---------- Nginx processes ----------
PID PPID VMSize Private Name
-------------------------------------
26615 1 230.7 MB 26.3 MB nginx: worker process
26616 1 230.4 MB 27.4 MB nginx: worker process
26617 1 229.7 MB 25.8 MB nginx: worker process
26618 1 233.3 MB 27.4 MB nginx: worker process
### Processes: 4
### Total private dirty RSS: 106.78 MB
--- Passenger processes ---
### Processes: 0
### Total private dirty RSS: 0.00 MB
Anyone knows how can I solve this?
When I ran sudo service nginx restart, I didn't notice the flag [fail] on the right of the terminal.
Then, I ran sudo service nginx status I got the message nginx is not running.
After ran sudo nginx -t I got the message
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
But I saw several nginx processes, then, I killed all nginx process with sudo kill $(ps aux | grep '[n]ginx' | awk '{print $2}') and then, sudo service nginx start.
Everything works fine again.

Why Passenger Apache in Centos 7 does not find my ruby on rails application?

I have my ruby on rails application installed in the path /var/www/sugnc
My linux user name is usersugnc, so I have a passenger configuration file with the same name in the path /etc/httpd/conf.d/usersugnc.conf
The content of that file is
<VirtualHost *:80>
RackEnv production
RailsEnv production
ServerName Nombredelservidor
DocumentRoot /var/www/sugnc/public
PassengerUser usersugnc
PassengerDisableAnonymousTelemetry on
PassengerInstanceRegistryDir /var/run/passenger-instreg
PassengerRoot /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerRuby /usr/local/rvm/gems/ruby-2.5.1/wrappers/ruby
<Directory /var/www/sugnc/public>
Allow from all
Options -MultiViews
# si apache es >= 2.4 (sudo httpd -v)
Require all granted
</Directory>
</VirtualHost>
When I restart apache all is ok. But passenger does not find or serves my application. When I run passenger-status I get this:
Version : 6.0.7
Date : 2020-12-06 12:32:23 +0000
Instance: zFQDHZbP (Apache/2.4.6 (CentOS) Phusion_Passenger/6.0.7)
Phusion Passenger is currently not serving any applications.
And when I run sudo tail -f /var/log/httpd/error_log I get
[Sun Dec 06 12:32:16.014559 2020] [lbmethod_heartbeat:notice] [pid 23285] AH02282: No slotmem from mod_heartmonitor
[ N 2020-12-06 12:32:16.0297 23290/T1 age/Cor/CoreMain.cpp:1325 ]: Passenger core shutdown finished
[ N 2020-12-06 12:32:16.0389 23310/T1 age/Wat/WatchdogMain.cpp:1373 ]: Starting Passenger watchdog...
[ N 2020-12-06 12:32:16.0647 23317/T1 age/Cor/CoreMain.cpp:1340 ]: Starting Passenger core...
[ N 2020-12-06 12:32:16.0648 23317/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2020-12-06 12:32:16.0727 23317/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 23317
[Sun Dec 06 12:32:16.078759 2020] [mpm_prefork:notice] [pid 23285] AH00163: Apache/2.4.6 (CentOS) Phusion_Passenger/6.0.7 configured -- resuming normal operations
[Sun Dec 06 12:32:16.078796 2020] [core:notice] [pid 23285] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[ N 2020-12-06 12:32:18.5868 23317/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
And this is the output when I run passenger-memory-stats
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Version: 6.0.7
Date : 2020-12-06 12:39:57 +0000
---------- Apache processes ----------
PID PPID VMSize Private Name
--------------------------------------
23285 1 289.5 MB ? /usr/sbin/httpd -DFOREGROUND
23331 23285 291.5 MB ? /usr/sbin/httpd -DFOREGROUND
23332 23285 291.5 MB ? /usr/sbin/httpd -DFOREGROUND
23333 23285 291.5 MB ? /usr/sbin/httpd -DFOREGROUND
23334 23285 291.5 MB ? /usr/sbin/httpd -DFOREGROUND
23335 23285 291.5 MB ? /usr/sbin/httpd -DFOREGROUND
### Processes: 6
### Total private dirty RSS: 0.00 MB (?)
-------- Nginx processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
23310 355.1 MB ? Passenger watchdog
23317 923.6 MB ? Passenger core
### Processes: 2
### Total private dirty RSS: 0.00 MB (?)
*** WARNING: Please run this tool with rvmsudo. Otherwise the private dirty RSS (a reliable metric for real memory usage) of processes cannot be determined.
What am I missing? What needs to be done?

CentOS *** ERROR: Phusion Passenger doesn't seem to be running

While i'm deploying my rails application through capistrano to my CentOS server all the time i have been receiving this error:
*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it is running, then the causes of this problem could be one
of:
You customized the instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's
passenger_instance_registry_dir option, or Phusion Passenger Standalone's
--instance-registry-dir command line argument. If so, please set the
environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
and run this command again.
The instance directory has been removed by an operating system background
service. Please set a different instance registry directory using Apache's
PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
option, or Phusion Passenger Standalone's --instance-registry-dir command
line argument.
On my server i have apache and passenger 5.0.30
Firstly i was looking on others answers here on stack:
Link to one of these topics.
Unfortunately nothing hasn't helped me. I tried to set the env path and others settings from apache conf as well.
Any idea what should i change in order to deploy my rails app?
Where is the full path to the first passenger-status in PATH? Does it match passenger_root?
Below are my logs:
$ passenger-config validate-install
> What would you like to validate? Use <space> to select. If the menu
> doesn't display correctly, press '!'
>
> ⬢ Passenger itself ‣ ⬢ Apache
>
> -------------------------------------------------------------------------
>
> Checking whether there are multiple Apache installations... Only a
> single installation detected. This is good.
>
> -------------------------------------------------------------------------
>
> * Checking whether this Passenger install is in PATH... ✓ * Checking
> whether there are no other Passenger installations... ✓ * Checking
> whether Apache is installed... ✓ * Checking whether the Passenger
> module is correctly configured in Apache... ✓
>
> Everything looks good. :-)
$ rvmsudo passenger-memory-stats
Version: 5.0.30
Date : 2016-11-15 13:43:44 +0100
---------- Apache processes ----------
PID PPID VMSize Private Name
--------------------------------------
25188 1 476.6 MB 1.5 MB /usr/sbin/httpd -DFOREGROUND
25220 25188 270.4 MB 0.5 MB /usr/sbin/httpd -DFOREGROUND
25246 25188 478.6 MB 0.2 MB /usr/sbin/httpd -DFOREGROUND
25247 25188 478.6 MB 0.2 MB /usr/sbin/httpd -DFOREGROUND
25248 25188 478.6 MB 0.2 MB /usr/sbin/httpd -DFOREGROUND
25249 25188 478.6 MB 0.2 MB /usr/sbin/httpd -DFOREGROUND
25250 25188 478.6 MB 0.2 MB /usr/sbin/httpd -DFOREGROUND
### Processes: 7
### Total private dirty RSS: 3.08 MB
-------- Nginx processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
25222 421.0 MB 0.9 MB Passenger watchdog
25225 772.6 MB 1.5 MB Passenger core
25234 431.3 MB 1.0 MB Passenger ust-router
### Processes: 3
### Total private dirty RSS: 3.39 MB
My apache config file:
<VirtualHost *:80>
ServerName www.app.com
ServerAdmin admin
DocumentRoot "/srv/www/app_name/current/public"
LoadModule passenger_module /home/userr/.rvm/gems/ruby-2.2.5/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so
#<IfModule mod_passenger.c>
# PassengerRuby /usr/local/rvm/gems/ruby-2.2.5
# PassengerRoot /usr/local/rvm/gems/ruby-2.2.5/gems/passenger-5.0.30
# PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.5/wrappers/ruby
# PassengerInstanceRegistryDir /tmp
#</IfModule>
<IfModule mod_passenger.c>
PassengerRoot /home/userr/.rvm/gems/ruby-2.2.5/gems/passenger-5.0.30
PassengerDefaultRuby /home/userr/.rvm/gems/ruby-2.2.5/wrappers/ruby
PassengerInstanceRegistryDir /tmp
</IfModule>
Options -Indexes -FollowSymLinks -MultiViews
LogLevel warn
ErrorLog logs/www.app.com-error.log
TransferLog logs/www.app.com-access.log
CustomLog logs/www.app.cp,.log combined
<Directory /srv/www/app_name/current/public>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from All
</IfModule>
</Directory>
</VirtualHost>
And my env path:
env file:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
LOGNAME=root
USER=root
USERNAME=root
HOME=/root
SUDO_COMMAND=/bin/env PASSENGER_INSTANCE_REGISTRY_DIR=/tmp
SUDO_USER=userr
SUDO_UID=1001
SUDO_GID=100
PASSENGER_INSTANCE_REGISTRY_DIR=/tmp
For sure i'm making something wrong. Thanks for every advice.
The problem seems to be systemd private temp feature, you can disable that for httpd:
mkdir /etc/systemd/system/httpd.service.d
echo "[Service]" > /etc/systemd/system/httpd.service.d/nopt.conf
echo "PrivateTmp=false" >> /etc/systemd/system/httpd.service.d/nopt.conf
systemctl daemon-reload
systemctl restart httpd
Passenger 5.0 no longer use /tmp for status information so it should work out of box even on private temps.
Finally i resolved my issue.
I have done two things.
Firstly i created new temp folder in my home directory. Then inside Apache config file i added
PassengerInstanceRegistryDir /home/userr/instancetemp
Then i pushed this to my env path with
echo 'PASSENGER_INSTANCE_REGISTRY_DIR=/home/userr/instancetemp' >> ~/.bash_profile
I think this is enough but i added also this path to my capistrano config
set :default_env, {
"PASSENGER_INSTANCE_REGISTRY_DIR" => "/home/userr/instancetemp"
}

docker apache passenger: error cannot load such file bundler/setup (LoadError)

I'm trying to build a docker-image with running apache (+passenger), rails and shibboleth.
Unfortunately I can't get apache + passenger running ...
I appreciate every hint! Maybe it is a permission problem? Everything was installed as root, but obviously some processes are running as nobody (as shown in the error log).
My docker base-image is "ruby:2.0.0" (debian 8). In this image I installed apache2, apache2-threaded-dev, libapr1-dev, libaprutil1-dev via apt-get and passenger via 'gem install passenger -v 4.0.59'. After this I used passenger-install-apache2-module to install the module.
Here is the error log:
cannot load such file -- bundler/setup (LoadError)
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:411:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:295:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:416:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:294:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
development
Ruby interpreter command
/usr/local/bin/ruby
User and groups
uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Apache passenger.load:
LoadModule passenger_module /usr/local/bundle/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
Apache passenger.conf:
IfModule mod_passenger.c>
PassengerRoot /usr/local/bundle/gems/passenger-4.0.59
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
And myapp.conf:
<VirtualHost *:80>
#ServerName yourserver.com
# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/myapp/public
PassengerRuby /usr/local/bin/ruby
RailsEnv development
# Relax Apache security settings
<Directory /var/www/myapp/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
Installed versions:
apache2 -v
Server version: Apache/2.4.10 (Debian)
ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299)
gem -v
2.0.14
rails -v
Rails 4.0.5
passenger-config validate-install says "Everything looks good". And 'passenger-status':
Version : 4.0.59
Date : 2015-10-13 09:03:32 +0000
Instance: 5578
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
/var/www/myapp#default:
App root: /var/www/myapp
Requests in queue: 0
passenger-memory-stats:
Version: 4.0.59
Date : 2015-10-13 09:05:31 +0000
--------- Apache processes ---------
PID PPID VMSize Private Name
------------------------------------
5578 1 83.2 MB ? /usr/sbin/apache2 -k start
5599 5578 363.5 MB ? /usr/sbin/apache2 -k start
5600 5578 491.5 MB ? /usr/sbin/apache2 -k start
### Processes: 3
### Total private dirty RSS: 0.00 MB (?)
-------- Nginx processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
---- Passenger processes -----
PID VMSize Private Name
------------------------------
5581 218.3 MB ? PassengerWatchdog
5584 564.5 MB ? PassengerHelperAgent
5590 217.8 MB ? PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 0.00 MB (?)
All running processes:
ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 20300 1780 ? Ss 08:47 0:00 bash
root 6077 0.0 0.0 85160 3208 ? Ss 09:11 0:00 /usr/sbin/apache2 -k start
root 6080 0.0 0.0 223500 2044 ? Ssl 09:11 0:00 PassengerWatchdog
root 6083 0.0 0.0 578092 5556 ? Sl 09:11 0:00 PassengerHelperAgent
nobody 6089 0.0 0.0 223028 5008 ? Sl 09:11 0:00 PassengerLoggingAgent
www-data 6098 0.0 0.0 437788 5452 ? Sl 09:11 0:00 /usr/sbin/apache2 -k start
www-data 6099 0.0 0.0 437780 5300 ? Sl 09:11 0:00 /usr/sbin/apache2 -k start
EDIT
After 2 days searching and trying I found a solution (right after I post here my question ...):
I have to put this into my apache virtual host configuration of my app:
SetEnv GEM_HOME /usr/local/bundle
This solution was postet on https://stackoverflow.com/a/19099768/4846489
I don't know why this is necessary, because I don't have a previous installation (as stated there). This is really strange, because this environment variable is already there if I login into my docker container (docker exec -u nobody)...
Setting GEM_HOME just patches over the real problem. This information here is your hint:
User and groups:
id=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Passenger is trying to run your app as the user 'nobody'. Most likely, this is not what you meant it to do. Your gem bundle is probably installed by a different user, and the 'nobody' user probably does not have access to that installed gem bundle.
Why is Passenger running your app as 'nobody'? Because of user sandboxing rules, most likely caused by wrong permissions on your app. You should fix that.
By the way, why are you building your own Docker image? Phusion provides its own passenger-docker base image.

Resources