簡體   English   中英

無法啟動乘客監視程序,但已安裝乘客

[英]Unable to start passenger watchdog but passenger installed

我想在ubuntu 12.04 VM(無用盒)上為nginx提供乘客支持。 因此,我創建了以下廚師食譜食譜( 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

它遵循此處的乘客安裝指南: https : //www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#install_add_apt_repo

但是,如果嘗試啟動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.

如果nginx在乘客支持下未正確編譯,這實際上似乎是一個常見錯誤。 但是,如果我檢查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

該錯誤實際上是正確的。 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

我有一個默認的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;

如果我刪除了passenger.conf nginx會正常啟動,並且默認測試頁正常。 由於預期的乘客不工作。

我的乘客應用程序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;
}

如果我嘗試訪問此頁面,則會收到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已正確安裝:

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

還安裝了乘客寶石。

vagrant@vagrant:~$ gem list passenger

*** LOCAL GEMS ***

passenger (4.0.45)

我真的不知道怎么了。 我檢查了這個線程,但是正如您在上面看到的那樣,我為nginx提供了乘客支持。 只是缺少旅客二進制文件?

任何想法如何解決這一問題?

在有人建議之前:我不想自己編譯nginx。 我想使用apt存儲庫中的版本,因為它極大地提高了流浪漢VM設置的性能。

您的passenger_root指令不正確。 您可以按照以下指南找到正確的值: https : //www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#inserting_passenger_root_for_apt

檢查passport-install-nginx-module是否正確安裝。

通過'which passenger-install-nginx-module'

如果未安裝,請嘗試:

rvmsudo passenger-install-nginx-module

這是針對rvm用戶的。 會解決問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM