Nginx配置檢測服務狀態(tài)的實現(xiàn)方法
更新時間:2019年05月09日 09:21:16 作者:winters04060
這篇文章主要介紹了Nginx配置檢測服務狀態(tài)的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
1. 查看是否安裝檢查狀態(tài)模塊;
[root@localhost ~]# nginx -V nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) configure arguments: --prefix=/usr/local/nginx --with-http_sub_module
2. 如未安裝,重新編譯安裝;
Ø 檢查狀態(tài)模塊;--with-http_stub_status_module
[root@localhost ~]# cd /usr/local/src/nginx-1.12.2/ [root@localhost ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module [root@localhost ~]# make && make install
3. 編輯nginx 的配置文件;
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf server { listen 80; server_name localhost; #access_log logs/host.access.log main; location /nginx_status { stub_status on; access_log off; #allow 127.0.0.1; ##可對該頁面的訪問者進行過濾 #deny all; } } [root@localhost ~]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@localhost ~]# nginx -s reload
4.測試語法;
[root@localhost ~]# curl http://192.168.10.110:80/nginx_status Active connections: 1 server accepts handled requests 1 1 1 Reading: 0 Writing: 1 Waiting: 0
5. 輸出內容詳解;
第一行 Active connections: 1 ——活躍的連接數(shù)量,包括等待客戶端數(shù)0 |
第二行 server accepts handled requests —— 總共處理了1個連接 , 成功創(chuàng)建1次握手, 總共處理了1個請求 |
第三行 Reading — 讀取客戶端的連接數(shù),Writing — 響應數(shù)據到客戶端的數(shù)量,Waiting — 開啟 keep-alive 的情況下,這個值等于 active – (reading+writing), 意思就是 Nginx 已經處理完正在等候下一次請求指令的駐留連接. |
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
PHP開發(fā)框架kohana3.3.1在nginx下的偽靜態(tài)設置例子
這篇文章主要介紹了PHP開發(fā)框架kohana3.3.1在nginx下的偽靜態(tài)設置例子,kohana曾經是codeigniter框架的衍生版,后來發(fā)展成另一個獨立的PHP5開發(fā)框架,需要的朋友可以參考下2014-07-07Nginx?502?bad?gateway錯誤解決的九種方案及原因
一般在訪問某些網站或者我們在做本地測試的時候,服務器突然返回502?Bad?Gateway?Nginx,這種問題相信大家也遇到不少了,下面這篇文章主要給大家介紹了關于Nginx?502?bad?gateway錯誤解決的九種方案及原因,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2022-08-08結合 Nginx 將 DoNetCore 部署到 阿里云的安裝配置方法
這篇文章主要介紹了結合 Nginx 將 DoNetCore 部署到 阿里云的方法 ,需要的朋友可以參考下2018-10-10