似乎nginx没有开始乘客

时间:2015-07-17 04:55:52

标签: ruby-on-rails ruby nginx passenger

之前我已经安装了nginx,所以当我使用乘客时,我用params重新编译nginx' - add-module = pathtopassenger'当我使用&nginx -t'时,我会通过&nginx -V'来替换/ usr / sbin /中的旧nginx。和' nginx -s reload',似乎一切正常,

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

但是当我访问我的网站时,它会出现500错误,如果我开始使用我的网站'乘客开始'在我的网站目录中,我可以访问我的网站。似乎nginx没有启动乘客。我使用ruby 2.1.2,乘客5.0.13,nginx 1.8.0。我的nginx conf是:

#user  nobody;
worker_processes  5;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
    use epoll;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;
    passenger_root /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.13;
    passenger_ruby /usr/local/rvm/wrappers/ruby-2.1.2/ruby;
    server {
    listen       80;
    server_name  xxxx.top www.xxxx.top;
    root  /root/myweb/public;
    location / {
        proxy_pass http://xxxx;
        passenger_enabled on;
    }
    passenger_enabled  on;
}
}

我现在使用的参数是&nginx -V'是:

--prefix=/usr/share/nginx 
--sbin-path=/usr/sbin/nginx
 --conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log 
--http-log-path=/var/log/nginx/access.log 
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body 
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy 
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
 --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi 
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi
 --pid-path=/var/run/nginx.pid 
--lock-path=/var/lock/subsys/nginx 
--user=nginx --group=nginx --with-file-aio 
--with-ipv6 --with-http_ssl_module --with-http_spdy_module 
--with-http_realip_module --with-http_addition_module 
--with-http_xslt_module --with-http_image_filter_module 
--with-http_geoip_module --with-http_sub_module
 --with-http_dav_module --with-http_flv_module 
--with-http_mp4_module --with-http_gunzip_module
 --with-http_gzip_static_module --with-http_random_index_module 
--with-http_secure_link_module 
--with-http_degradation_module 
--with-http_stub_status_module 
--with-http_perl_module --with-mail
 --with-mail_ssl_module --with-pcre --with-pcre-jit
 --with-google_perftools_module 
--add-module=/usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.13/ext/nginx 
--with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=' -Wl,-E'

2 个答案:

答案 0 :(得分:1)

location / {
    proxy_pass http://xxxx;
    passenger_enabled on;
}

您不应该同时使用proxy_pass和乘客。使用proxy_pass转发,或使用Passenger。

另外,你应该read the Nginx error log。也许Passenger遇到了某种问题,它会记录到日志文件中。

答案 1 :(得分:0)

也许问题在这里:

--add-module=/usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.13/ext/nginx

请参阅https://groups.google.com/forum/#!topic/phusion-passenger/TeJLk6MVUrA

安装Passenger 5时,ext / nginx模块已移至src / nginx_module。所以你可以尝试下面编译nginx:

--add-module=/usr/local/rvm/gems/ruby-2.1.2/gems/passenger-5.0.13/src/nginx_module