我剛剛在 Bluehost 設定了一個 vps。 Centos 6。
[ ... ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
我多次重新啟動 nginx,檢查其運行級別,用一對正在運行的應用程式進行測試......但我無法阻止 nginx 繼續關閉。
於是,我到處尋找。在 StackOverflow乘客作者建議按照說明重新安裝,我做了(兩次)但沒有更好的結果。
進一步挖掘發現了這個類似的問題還沒有好的答案。
進一步挖掘,我發現了一個解決方案在伺服器故障中,與 Rails 應用程式相關,就像我的例子一樣。但我找不到rubber-passenger_nginx.yml,因為我沒有使用rubber。
關於編譯所有最新版本,我仔細檢查了 nginx、passenger(在伺服器上使用 yum 安裝並作為 gem 包含在應用程式中)、rvm、ruby、我的 Rails 應用程式設定。一切都好。但是 nginx 停止了。請幫忙...
感謝@drookie 的評論。我收集了一些信息,並試圖學習如何在 Linux 中追蹤 SIGINT。這是最新安裝相同錯誤的軌跡,安裝的第一個錯誤。我得到了大約 100 個 GET /whm-server-status HTTP/1.0 的 404(為什麼 nginx 要求 apache?),然後:
App 17918 stdout:
App 18051 stdout:
2015/09/28 23:15:01 [error] 14602#0: *179 open() "/usr/share/nginx/html/whm-server-status" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /whm-server-status HTTP/1.0"
[ 2015-09-28 23:16:03.2224 14578/7f23d3390700 age/Cor/CoreMain.cpp:793 ]: Disconnecting long-running connections for process 18051, application /home/user/ror/app/current/public
[ 2015-09-28 23:16:55.1231 14578/7f23d28bc700 age/Cor/CoreMain.cpp:506 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2015-09-28 23:16:55.1232 14578/7f23d33d2800 age/Cor/CoreMain.cpp:875 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2015-09-28 23:16:55.1232 14578/7f23d33d2800 age/Cor/CoreMain.cpp:793 ]: Disconnecting long-running connections for process 14734, application /home/user/ror/app/current/public
[ 2015-09-28 23:16:55.1237 14578/7f23d28bc700 Ser/Server.h:758 ]: [ServerThr.1] Freed 128 spare client objects
[ 2015-09-28 23:16:55.1238 14578/7f23d28bc700 Ser/Server.h:443 ]: [ServerThr.1] Shutdown finished
[ 2015-09-28 23:16:55.1238 14578/7f23d1e3a700 Ser/Server.h:758 ]: [ServerThr.2] Freed 128 spare client objects
[ 2015-09-28 23:16:55.1238 14578/7f23d1e3a700 Ser/Server.h:443 ]: [ServerThr.2] Shutdown finished
[ 2015-09-28 23:16:55.1241 14578/7f23d13b8700 Ser/Server.h:758 ]: [ApiServer] Freed 0 spare client objects
[ 2015-09-28 23:16:55.1241 14583/7fd4931c3700 age/Ust/UstRouterMain.cpp:396 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2015-09-28 23:16:55.1241 14578/7f23d13b8700 Ser/Server.h:443 ]: [ApiServer] Shutdown finished
[ 2015-09-28 23:16:55.1242 14583/7fd493453800 age/Ust/UstRouterMain.cpp:466 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2015-09-28 23:16:55.1242 14578/7f23d33d2800 age/Cor/CoreMain.cpp:793 ]: Disconnecting long-running connections for process 14734, application /home/user/ror/app/current/public
[ 2015-09-28 23:16:55.1242 14583/7fd492741700 Ser/Server.h:758 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2015-09-28 23:16:55.1242 14583/7fd492741700 Ser/Server.h:443 ]: [UstRouterApiServer] Shutdown finished
[ 2015-09-28 23:16:55.1244 14583/7fd4931c3700 Ser/Server.h:443 ]: [UstRouter] Shutdown finished
[ 2015-09-28 23:16:55.1245 14583/7fd493453800 age/Ust/UstRouterMain.cpp:497 ]: Passenger UstRouter shutdown finished
[ 2015-09-28 23:16:55.3360 14578/7f23d33d2800 age/Cor/CoreMain.cpp:941 ]: Passenger core shutdown finished
ps 阿爾克斯 | grep nginx 輸出:
1 0 374 1 20 0 108560 1864 rt_sig Ss ? 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
5 399 375 374 20 0 109000 3132 ep_pol S ? 0:00 nginx: worker process
0 500 593 32668 20 0 103304 832 - R+ pts/0 0:00 grep nginx
這裡是/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
client_max_body_size 5M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 3;
#gzip on;
index index.html index.htm;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name localhost;
root /usr/share/nginx/html;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
# redirect server error pages to the static page /40x.html
#
error_page 404 /404.html;
location = /40x.html {
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
答案1
我發現問題不是nginx或passenger的問題。伺服器已安裝 WHM。因此,控制面板的安全性正在改變我在 bash 中發出的命令。另外,安裝很舊。更新whm並正確使用後,nginx關閉的問題就解決了。 @drookie,你是對的,不是一個簡單的守護進程,而是整個whm造成的。謝謝。