Wei Xu
Wei Xu

Reputation: 19

It seems that nginx didn't start passenger

I have installed nginx before,so when I use passenger ,I recompile nginx with params '--add-module=pathtopassenger' and the params I get by 'nginx -V',and replace the old nginx in /usr/sbin/, when i use 'nginx -t' and 'nginx -s reload', it seems everything is ok,

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

but when i access my site ,it get 500 error, if I start my website use 'passenger start' in my website directory,I can access my website.it seems that nginx didn't start passenger. I use ruby 2.1.2, passenger 5.0.13,nginx 1.8.0.and my nginx conf is :

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

the params now I get with 'nginx -V' is :

--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'

Upvotes: 0

Views: 813

Answers (2)

jayhsu21
jayhsu21

Reputation: 36

Maybe problem is here:

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

See https://groups.google.com/forum/#!topic/phusion-passenger/TeJLk6MVUrA

When you install Passenger 5, the ext/nginx module was moved to src/nginx_module. So you can try below to compile nginx:

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

Upvotes: 0

Hongli
Hongli

Reputation: 18924

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

You're not supposed to use proxy_pass and Passenger at the same time. Either use proxy_pass forwarding, or use Passenger.

Also, you should read the Nginx error log. Maybe Passenger encountered some kind of issue, which it will log to the log file.

Upvotes: 1

Related Questions