Ruby on rails Nginx和Phusion正在运行,但乘客状态显示0个进程正在运行
我在生产服务器上安装了一个rails应用程序,其中安装了Passenger和Nginx(带有Passenger模块)。但是,当我运行Ruby on rails Nginx和Phusion正在运行,但乘客状态显示0个进程正在运行,ruby-on-rails,linux,nginx,passenger,Ruby On Rails,Linux,Nginx,Passenger,我在生产服务器上安装了一个rails应用程序,其中安装了Passenger和Nginx(带有Passenger模块)。但是,当我运行rvmsudo passenger status时,它显示0个进程正在运行 以下是我的nginx.conf,仅供参考: #user www-data; user root; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_acc
rvmsudo passenger status
时,它显示0个进程正在运行
以下是我的nginx.conf,仅供参考:
#user www-data;
user root;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
#passenger_ruby /usr/bin/ruby;
passenger_ruby /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites enabled/
目录包含相关的服务器信息
以下是ps aux | grep nginx
的输出:
root 11417 0.0 0.0 42412 1076 ? Ss 13:13 0:00 nginx: master process /opt/nginx/sbin/nginx
nobody 11418 0.0 0.0 42852 1844 ? S 13:13 0:00 nginx: worker process
当我通过网络浏览器访问该网站时,我会看到一个“欢迎使用nginx!”登录页
我在这方面完全是个新手,所以可能会有一些简单的事情发生,但我只需要启动它。任何帮助都将不胜感激
编辑:
rvmsudo乘客状态的输出
:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
Version : 4.0.42
Date : 2014-12-22 14:04:17 -0500
Instance: 11417
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
rvmsudo乘客记忆统计数据的输出
:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
Version: 4.0.42
Date : 2014-12-22 14:07:57 -0500
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.
---------- Nginx processes ----------
PID PPID VMSize Private Name
-------------------------------------
11417 1 41.4 MB 0.1 MB nginx: master process /opt/nginx/sbin/nginx
11418 11417 41.8 MB 0.6 MB nginx: worker process
### Processes: 2
### Total private dirty RSS: 0.71 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
11399 218.3 MB 0.3 MB PassengerWatchdog
11402 491.5 MB 0.4 MB PassengerHelperAgent
11408 232.9 MB 1.1 MB PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 1.74 MB
@标记:在
/etc/nginx/sites enabled/
下有一个文件,如下所示:
server {
listen 443;
server_name REDACTED;
ssl on;
ssl_certificate REDACTED;
ssl_certificate_key REDACTED;
#auth_basic "REDACTED";
#auth_basic_user_file REDACTED;
client_max_body_size 250m;
client_body_buffer_size 128k;
access_log REDACTED;
error_log REDACTED;
root REDACTED;
passenger_enabled on;
rack_env production;
location ~ ^/assets/ {
add_header Cache-Control public;
add_header ETag "";
expires 1y;
break;
}
# disable site via capistrano (cap deploy:web:disable)
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
}
server {
listen 80;
server_name REDACTED;
client_max_body_size 250m;
client_body_buffer_size 128k;
access_log REDACTED;
error_log REDACTED;
rewrite ^ https://www.REDACTED.com$request_uri? break;
}
这是我的作者。我99%确定这只是一个Nginx配置错误 首先是Phusion Passenger,所以您看到“0个进程”是正常的,除非使用显式配置
线索是,当您尝试访问您的站点时,您会看到“欢迎使用nginx”。在99%的情况下,这意味着您的虚拟主机配置错误。由于您编辑了配置文件,我无法告诉您到底是哪里出了问题,但这表明Nginx没有将您的请求与您希望与之关联的虚拟主机块相关联。如果您发布未经编辑的配置文件和访问的URL,我可以告诉您更多信息。但除此之外,我只能告诉您研究Nginx的服务器名称匹配是如何工作的。那么,您在这台服务器上部署了Rails应用程序吗?如果是,vhost文件是什么样子的?问题是应用程序在服务器上,但似乎没有部署。知道我在哪里可以找到vhost文件吗?我不是最初配置东西的人;整个系统是继承的。根据nginx.conf文件,它应该在
/etc/nginx/sites enabled/
下。另外,您是否尝试重新启动nginx或passenger?@tagCincy请参阅下面的答案。@tagCincy同样,我已重新启动nginx几次,但均未成功。是否有可能以某种方式将配置文件脱机发送给您?