gpt4 book ai didi

ruby-on-rails - Nginx 和 Phusion Passenger 正在运行,但 passenger-status 显示 0 个进程正在运行

转载 作者:太空宇宙 更新时间:2023-11-04 09:35:03 27 4
gpt4 key购买 nike

我在安装了 Passenger 和 Nginx(带有 Passenger 模块)的生产服务器上安装了一个 Rails 应用程序。但是,当我运行 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/目录包含了相关的Server信息。

这是 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 passenger-status 的输出:

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 passenger-memory-stats 的输出:

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

最佳答案

Phusion Passenger 作者在这里。我 99% 确定这只是一个 Nginx 配置错误。

首先,Phusion Passenger starts your app at the first request ,所以您看到“0 个进程”是正常的——除非使用 passenger_pre_start 明确配置.

线索是当您尝试访问您的站点时看到“Welcome to nginx”。在 99% 的情况下,这意味着您配置的虚拟主机有误。因为你编辑了你的配置文件,我不能告诉你到底出了什么问题,但这表明 Nginx 没有将你的请求与你希望它关联的虚拟主机 block 关联起来。如果您发布未经编辑的配置文件和您正在访问的 URL,我可以告诉您更多信息。但除此之外,我只能告诉你研究Nginx的服务器名称匹配是如何工作的。

关于ruby-on-rails - Nginx 和 Phusion Passenger 正在运行,但 passenger-status 显示 0 个进程正在运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27608262/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com