简体   繁体   English

无法启动乘客监视程序,但已安装乘客

[英]Unable to start passenger watchdog but passenger installed

I want to setup nginx with passenger support on ubuntu 12.04 VM (vagrant box). 我想在ubuntu 12.04 VM(无用盒)上为nginx提供乘客支持。 Therefore I created the following chef cookbook recipe ( https://github.com/i42n/wrapper-nginx-passenger/blob/master/recipes/default.rb ): 因此,我创建了以下厨师食谱食谱( https://github.com/i42n/wrapper-nginx-passenger/blob/master/recipes/default.rb ):

#
# Cookbook Name:: wrapper-nginx-passenger
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute

apt_repository 'nginx-passenger' do
  uri          'https://oss-binaries.phusionpassenger.com/apt/passenger'
  distribution node['lsb']['codename']
  components   ['main']
  keyserver    'keyserver.ubuntu.com'
  key          '561F9B9CAC40B2F7'
end

# install nginx which contains passenger support
package "nginx-extras"
package "passenger"

# define nginx service as the nginx::passenger recipe restarts the service
# and fails if the service does not exist
service 'nginx' do
  supports :status => true, :restart => true, :reload => true
  action   :start
end

# installs the passenger gem
include_recipe "nginx::passenger"

# create server config template in nginx config directory
template "/etc/nginx/sites-available/plantasy" do
  source "plantasy.erb"
  mode 0644
  owner "root"
  group "root"
end

# symlink the config to the active sites directory
link "/etc/nginx/sites-enabled/plantasy" do
  to "/etc/nginx/sites-available/plantasy"
end

It follows the passenger installation guide from here: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_add_apt_repo 它遵循此处的乘客安装指南: https : //www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_add_apt_repo

However if I try to start nginx I get the following error: 但是,如果尝试启动nginx,则会出现以下错误:

vagrant@vagrant:/etc/nginx/conf.d$ sudo service nginx restart
 * Restarting nginx nginx
nginx: [alert] Unable to start the Phusion Passenger watchdog because its executable (/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/buildout/agents/PassengerWatchdog) does not exist. This probably means that your Phusion Passenger installation is broken or incomplete, or that your 'passenger_root' directive is set to the wrong value. Please reinstall Phusion Passenger or fix your 'passenger_root' directive, whichever is applicable. (-1: Unknown error)
   ...done.

This actually seems a common error if nginx has not been compiled correctly with passenger support. 如果nginx在乘客支持下未正确编译,这实际上似乎是一个常见错误。 However if I check the nginx modules my nginx does have passenger support: 但是,如果我检查nginx模块,我的nginx确实有乘客支持:

vagrant@vagrant:~$ nginx -V
nginx version: nginx/1.6.0
TLS SNI support enabled
configure arguments: --with-cc-opt= --with-ld-opt= --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/headers-more-nginx-module --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-auth-pam --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-cache-purge --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-dav-ext-module --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-development-kit --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-echo --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/ngx-fancyindex --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-http-push --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-lua --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-upload-progress --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/nginx-upstream-fair --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/ngx_http_substitutions_filter_module --add-module=/tmp/buildd/nginx-1.6.0/debian/modules/passenger/ext/nginx

The error is actually correct. 该错误实际上是正确的。 The file/folder passenger is looking for on nginx startup is not present: nginx启动时正在寻找的文件/文件夹乘客不存在:

vagrant@vagrant:/etc/nginx/conf.d$ ls -l /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45
total 196
-rw-r--r--  1 vagrant root 80232 Jul  7 13:38 CHANGELOG
-rw-r--r--  1 vagrant root 15919 Jul  7 13:38 CONTRIBUTING.md
-rw-r--r--  1 vagrant root  1035 Jul  7 13:38 CONTRIBUTORS
-rw-r--r--  1 vagrant root   363 Jul  7 13:38 INSTALL.md
-rw-r--r--  1 vagrant root  1056 Jul  7 13:38 LICENSE
-rw-r--r--  1 vagrant root  2880 Jul  7 13:38 README.md
-rw-r--r--  1 vagrant root  1814 Jul  7 13:38 Rakefile
-rw-r--r--  1 vagrant root  2345 Jul  7 13:38 Vagrantfile
drwxr-xr-x  2 vagrant root  4096 Jul  7 13:38 bin
drwxr-xr-x  2 vagrant root  4096 Jul  7 13:38 build
-rwxr-xr-x  1 vagrant root   287 Jul  7 13:38 configure
drwxr-xr-x  4 vagrant root  4096 Jul  7 13:38 debian.template
drwxr-xr-x  4 vagrant root  4096 Jul  7 13:38 dev
drwxr-xr-x  5 vagrant root  4096 Jul  7 13:38 doc
drwxr-xr-x  2 vagrant root  4096 Jul  7 13:38 download_cache
drwxr-xr-x 10 vagrant root  4096 Jul  7 13:38 ext
drwxr-xr-x  3 vagrant root  4096 Jul  7 13:38 helper-scripts
drwxr-xr-x  3 vagrant root  4096 Jul  7 13:38 lib
drwxr-xr-x  2 vagrant root  4096 Jul  7 13:38 man
drwxr-xr-x  3 vagrant root  4096 Jul  7 13:38 node_lib
-rw-r--r--  1 vagrant root  6514 Jul  7 13:38 npm-shrinkwrap.json
-rw-r--r--  1 vagrant root   722 Jul  7 13:38 package.json
-rw-r--r--  1 vagrant root  1243 Jul  7 13:38 passenger.gemspec
drwxr-xr-x  4 vagrant root  4096 Jul  7 13:38 resources
drwxr-xr-x  2 vagrant root  4096 Jul  7 13:38 rpm
drwxr-xr-x 10 vagrant root  4096 Jul  7 13:38 test

I have a default nginx.conf and /etc/nginx/conf.d/passenger.conf looks like this: 我有一个默认的nginx.conf/etc/nginx/conf.d/passenger.conf看起来像这样:

vagrant@vagrant:/etc/nginx/conf.d$ cat /etc/nginx/conf.d/passenger.conf 
passenger_root /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45;
passenger_ruby /usr/local/rvm/rubies/ruby-2.1.2/bin/ruby;
passenger_max_pool_size 6;
passenger_spawn_method smart-lv2;
passenger_buffer_response on;
passenger_min_instances 1;
passenger_max_instances_per_app 0;
passenger_pool_idle_time 300;
passenger_max_requests 0;

If I remove the passenger.conf nginx starts without errors and serves the default test page fine. 如果我删除了passenger.conf nginx会正常启动,并且默认测试页正常。 As expectable passenger does not work. 由于预期的乘客不工作。

My passenger app nginx config looks like this: 我的乘客应用程序nginx配置看起来像这样:

vagrant@vagrant:~$ cat /etc/nginx/sites-enabled/plantasy 
# Only for development purposes.
# For production environment, set it accordingly (i.e. production)
# Remove this line when you upload an actual application.
# For * TESTING * purposes only.
passenger_app_env development;

server {
  listen 8080;
  server_name example.com;
  passenger_enabled on;
  passenger_ruby /usr/local/rvm/rubies/ruby-2.1.2/bin/ruby;
  root /home/vagrant/app/public;
}

If I try to access this page, I get a 403: 如果我尝试访问此页面,则会收到403:

vagrant@vagrant:~$ curl localhost:8080
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.6.0</center>
</body>
</html>

Ruby is installed correctly: Ruby已正确安装:

vagrant@vagrant:~$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

Also the passenger gem is installed. 还安装了乘客宝石。

vagrant@vagrant:~$ gem list passenger

*** LOCAL GEMS ***

passenger (4.0.45)

I really do not know what's wrong. 我真的不知道怎么了。 I checked out this thread but as you can see above, I have nginx present with passenger support. 我检查了这个线程,但是正如您在上面看到的那样,我为nginx提供了乘客支持。 It's just the passenger binary missing? 只是缺少旅客二进制文件?

Any ideas how to fix this? 任何想法如何解决这一问题?

And before anyone suggests it: I do not want to compile nginx myself. 在有人建议之前:我不想自己编译nginx。 I want to use the version from the apt repository as it speeds up performance on vagrant VM setup very much. 我想使用apt存储库中的版本,因为它极大地提高了流浪汉VM设置的性能。

Your passenger_root directive is incorrect. 您的passenger_root指令不正确。 You can discover the correct value for it by following the guide here: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#inserting_passenger_root_for_apt 您可以按照以下指南找到正确的值: https : //www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#inserting_passenger_root_for_apt

Check passenger-install-nginx-module is properly installed. 检查passport-install-nginx-module是否正确安装。

By 'which passenger-install-nginx-module' 通过'which passenger-install-nginx-module'

if not installed, try with: 如果未安装,请尝试:

rvmsudo passenger-install-nginx-module

This is for rvm users. 这是针对rvm用户的。 Will solve problem 会解决问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM