002 nginx + passenger 配置不成功,请各位帮忙!!

Post date: 2013/5/28 上午 05:35:00

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

passenger 需要编译 nginx 的时候链接进去的,LZ 应该是没有正确编译

你照着这个来呗 http://ruby-china.org/topics/701

#2楼 @kaka passenger 有一个 passenger-install-nginx-module 脚本帮助编译 nginx

#3楼 @ywencn 看看。

可以参考官方文档:http://www.modrails.com/install.html

配置文件nginx的所在目录不对~

运行 passenger-install-nginx-module 的时候,选择Yes, Download and compile Nginx.

楼主用的是Mac么?这里有一篇wiki http://ruby-china.org/wiki/mac-nginx-passenger-rails

#9楼 @lgn21st 谢谢回复

我是根据这个去部署的,就是在sudo nginx -t测试有点问题! 被卡住了,请大侠帮忙

#10楼 @kaka 应该是你的nginx没有安装正确,或者rvm有问题。从错误消息来看,nginx在activate passenger的时候无法在指定目录找到PassengerWatchdog,那么passenger在自送安装nginx的时候把这这个安装到什么地方去了呢?

#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()

#11楼 @lgn21st 刚才那个是端口占用了

#12楼 @kaka 这是因为nginx已经被启动起来了,80端口已经被占用了,或者80端口被其他进程占用。

重新加载nginx的配置文件:

nginx -s reload

停止nginx的方法

nginx -s stop

启动nginx的方法

nginx

#14楼 @lgn21st 我可以改端口吗?

#15楼 @kaka 这个...你想知道nginx如何改端口么?问Google比问我快。

#16楼 @lgn21st 知道改端口!只是不确认! 我现在打开本地域名报404错误..是不是还有那里没有改好啊

#17楼 @kaka 这个要看log,分别要看nginx的log和rails的log,判断问题出在nginx这边还是rails端。

#18楼 @lgn21st

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; }

#19楼 @kaka 贴完整的nginx.conf吧

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

#21楼 @kaka 比过wiki上的配置了么?

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; } } }

#22楼 @lgn21st

已经打开本地域是404错误,重启一下电脑就连接不到服务器了

#22楼 @lgn21st 真的麻烦你了 重启一下nginx 可以打开本地域 403没有权限不知道说那个文件没权限

2012/01/04 21:11:49 [error] 559#0: *3 "/Users/kaka/Documents/soft/neza/public/index.html" is forbidden (13: Permission denied), client: 127.0.0.1, server: kaka.local, request: "GET / HTTP/1.1", host: "kaka.local"

这个问题解决了吗?貌似我也有这个情况。

这个问题在升级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;

即可。

611
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3
Large_f08750e605d58ff54872d955169ce0c3

Rei 4楼, 1年前

jojojo 5楼, 1年前

reyesyang 6楼, 1年前

Lucifer 7楼, 1年前

hisea 8楼, 1年前

lgn21st 9楼, 1年前

kaka 10楼, 1年前

kaka 12楼, 1年前

kaka 13楼, 1年前

kaka 15楼, 1年前

kaka 17楼, 1年前

kaka 19楼, 1年前

kaka 21楼, 1年前

kaka 23楼, 1年前

kaka 24楼, 1年前

lgn21st 11楼, 1年前

lgn21st 14楼, 1年前

lgn21st 16楼, 1年前

lgn21st 18楼, 1年前

lgn21st 20楼, 1年前

lgn21st 22楼, 1年前

rickyuan 25楼, 1年前

ericguo 26楼, 8月前