kakamatoiMac:/ kaka$ sudo nginx -t
Password:
nginx: [emerg] unknown directive "passenger_root" in /usr/local/nginx/conf/nginx.conf:18
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
nginx.conf
18 行
passenger_root /Users/kaka/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11;
passenger_ruby /Users/kaka/.rvm/wrappers/ruby-1.9.2-p290/ruby;
这个错误是我的 passenger 没有配置好吗?新手求解 谢谢
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: [alert] Unable to start the Phusion Passenger watchdog because its executable (/Users/kaka/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/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)
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
#11 楼 @lgn21st 现在 sudo nginx -t 可以通过了,但是 sudo nginx 启动时出下面这种情况! nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use) nginx: [emerg] still could not bind()
2012/01/04 16:31:57 [error] 6726#0: *23 "/Users/kaka/kaka/public#html/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: kaka.local, request: "GET / HTTP/1.1", host: "kaka.local"
2012/01/04 16:31:57 [error] 6726#0: *23 open() "/Users/kaka/kaka/public#html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: kaka.local, request: "GET /favicon.ico HTTP/1.1", host: "kaka.local"
我已经改了这个 root 路径 ,为什么还会找以前 /Users/kaka/kaka/public#html/index.html
这个路径呢!我重启了 Nginx
location / {
root /Users/kaka/Documents/soft/neza/public; #html;
#index /products/index
index index.html index.htm;
}
worker_processes 1;
events { worker_connections 1024; }
http { passenger_root /Library/Ruby/Gems/1.8/gems/passenger-3.0.11; passenger_ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby;
include mime.types; default_type application/octet-stream;
sendfile on; keepalive_timeout 65;
server { listen 81; server_name kaka.local;
location / { root /Users/kaka/Documents/soft/neza/public; #html; #index /products/index index index.html index.htm; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } #20 楼 @lgn21st
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /Users/Daniel/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.10;
passenger_ruby /Users/Daniel/.rvm/wrappers/ruby-1.9.2-p290/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name awesome_project.local;
root /Users/Daniel/awesome_project/public;
passenger_enabled on;
rails_env development;
}
}
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /Library/Ruby/Gems/1.8/gems/passenger-3.0.11;
passenger_ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server
{
listen 81;
server_name kaka.local;
location / {
root /Users/kaka/Documents/soft/neza/public; #html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
这个问题在升级 passenger 的时候比较容易发生,解决很简单
passenger_root /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.15;
改为passenger-config --root
输出的目录
passenger_root /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17;
即可。