首頁 php教程 php手册 启用php-fpm状态详解

启用php-fpm状态详解

Jun 06, 2016 pm 08:12 PM
nginx php-fpm 啟用 狀態 詳解

php-fpm和nginx一样内建了一个状态页,对于想了解php-fpm的状态以及监控php-fpm非常有帮助。为了后续的zabbix监控,我们需要先了解php-fpm状态页是怎么回事。 1. 启用php-fpm状态功能 # cat? /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_pathpm.s

php-fpm和nginx一样内建了一个状态页,对于想了解php-fpm的状态以及监控php-fpm非常有帮助。为了后续的zabbix监控,我们需要先了解php-fpm状态页是怎么回事。 1. 启用php-fpm状态功能
# cat? /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_path
pm.status_path = /status
登入後複製
默认情况下为/status,当然也可以改成其他的,例如/ttlsa_status等等。 2. nginx配置 在默认主机里面加上location或者你希望能访问到的主机里面。
server {
??? listen? *:80 default_server;
??? server_name _;
??? location ~ ^/(status|ping)$
??? {
?? ??? ?include fastcgi_params;
?? ??? ?fastcgi_pass 127.0.0.1:9000;
?? ??? ?fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
??? }
}
登入後複製
3. 重启nginx/php-fpm 请依照你的环境重启你的nginx和php-fpm
# service nginx restart
# service php-fpm restart
登入後複製
4. 打开status页面
# curl http://www.ttlsa.com/status
pool:???????????????? www
process manager:????? dynamic
start time:?????????? 14/May/2014:22:40:15 +0800
start since:????????? 58508
accepted conn:??????? 33
listen queue:???????? 0
max listen queue:???? 8
listen queue len:???? 0
idle processes:?????? 2
active processes:???? 1
total processes:????? 3
max active processes: 5
max children reached: 0
slow requests:??????? 2091
登入後複製
5. php-fpm status详解 pool – fpm池子名称,大多数为www process manager – 进程管理方式,值:static, dynamic or ondemand. dynamic start time – 启动日期,如果reload了php-fpm,时间会更新 start since – 运行时长 accepted conn – 当前池子接受的请求数 listen queue – 请求等待队列,如果这个值不为0,那么要增加FPM的进程数量 max listen queue – 请求等待队列最高的数量 listen queue len – socket等待队列长度 idle processes – 空闲进程数量 active processes – 活跃进程数量 total processes – 总进程数量 max active processes – 最大的活跃进程数量(FPM启动开始算) max children reached - 大道进程最大数量限制的次数,如果这个数量不为0,那说明你的最大进程数量太小了,请改大一点。 slow requests – 启用了php-fpm slow-log,缓慢请求的数量 6. php-fpm其他参数 php-fpm状态页比较个性化的一个地方是它可以带参数,可以带参数json、xml、html并且前面三个参数可以分别和full做一个组合。 6.1 json
# curl http://127.0.0.1/status?json
{"pool":"www","process manager":"dynamic","start time":1400078415,"start since":59624,"accepted conn":27,"listen queue":0,"max listen queue":8,"listen queue len":0,"idle processes":2,"active processes":1,"total processes":3,"max active processes":5,"max children reached":0,"slow requests":2145}
登入後複製
6.2 xml
# curl http://127.0.0.1/status?xml
<?xml version="1.0" ?>
www
dynamic
1400078415
59640
36
0
8
0
2
1
3
5
0
2145
登入後複製
6.3 html
# curl http://127.0.0.1/status?html

PHP-FPM Status Page
poolwww
process managerdynamic
start time14/May/2014:22:40:15 +0800
start since59662
accepted conn8
listen queue0
max listen queue8
listen queue len0
idle processes2
active processes1
total processes3
max active processes5
max children reached0
slow requests2147
登入後複製
6.4 full
# curl http://127.0.0.1/status?full
pool:???????????????? www
process manager:????? dynamic
start time:?????????? 14/May/2014:22:40:15 +0800
start since:????????? 59695
accepted conn:??????? 1
listen queue:???????? 0
max listen queue:???? 8
listen queue len:???? 0
idle processes:?????? 2
active processes:???? 1
total processes:????? 3
max active processes: 5
max children reached: 0
slow requests:??????? 2148
************************
pid:????????????????? 29050
state:??????????????? Idle
start time:?????????? 15/May/2014:15:09:32 +0800
start since:????????? 338
requests:???????????? 62
request duration:???? 1025585
request method:?????? GET
request URI:????????? /index.php
content length:?????? 0
user:???????????????? -
script:?????????????? /data/site/www.ttlsa.com/index.php
last request cpu:???? 45.83
last request memory:? 24903680
.....省略几个PID....
登入後複製
6.5 full详解 pid – 进程PID,可以单独kill这个进程. You can use this PID to kill a long running process. state – 当前进程的状态 (Idle, Running, …) start time – 进程启动的日期 start since – 当前进程运行时长 requests – 当前进程处理了多少个请求 request duration – 请求时长(微妙) request method – 请求方法 (GET, POST, …) request URI – 请求URI content length – 请求内容长度 (仅用于 POST) user – 用户 (PHP_AUTH_USER) (or ‘-’ 如果没设置) script – PHP脚本 (or ‘-’ if not set) last request cpu – 最后一个请求CPU使用率。 last request memorythe - 上一个请求使用的内存 7. 完成 php-fpm状态页非常使用,使用zabbix或者nagios监控可以考虑使用xml或者默认方式。用web的话,推荐使用html,表格会比较清晰。
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌
威爾R.E.P.O.有交叉遊戲嗎?
1 個月前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

怎麼查看nginx是否啟動 怎麼查看nginx是否啟動 Apr 14, 2025 pm 01:03 PM

確認 Nginx 是否啟動的方法:1. 使用命令行:systemctl status nginx(Linux/Unix)、netstat -ano | findstr 80(Windows);2. 檢查端口 80 是否開放;3. 查看系統日誌中 Nginx 啟動消息;4. 使用第三方工具,如 Nagios、Zabbix、Icinga。

nginx怎麼配置雲服務器域名 nginx怎麼配置雲服務器域名 Apr 14, 2025 pm 12:18 PM

在雲服務器上配置 Nginx 域名的方法:創建 A 記錄,指向雲服務器的公共 IP 地址。在 Nginx 配置文件中添加虛擬主機塊,指定偵聽端口、域名和網站根目錄。重啟 Nginx 以應用更改。訪問域名測試配置。其他注意事項:安裝 SSL 證書啟用 HTTPS、確保防火牆允許 80 端口流量、等待 DNS 解析生效。

nginx在windows中怎麼配置 nginx在windows中怎麼配置 Apr 14, 2025 pm 12:57 PM

如何在 Windows 中配置 Nginx?安裝 Nginx 並創建虛擬主機配置。修改主配置文件並包含虛擬主機配置。啟動或重新加載 Nginx。測試配置並查看網站。選擇性啟用 SSL 並配置 SSL 證書。選擇性設置防火牆允許 80 和 443 端口流量。

nginx403怎麼解決 nginx403怎麼解決 Apr 14, 2025 am 10:33 AM

如何解決 Nginx 403 Forbidden 錯誤?檢查文件或目錄權限;2. 檢查 .htaccess 文件;3. 檢查 Nginx 配置文件;4. 重啟 Nginx。其他可能原因還包括防火牆規則、SELinux 設置或應用程序問題。

linux怎麼查看nginx是否啟動 linux怎麼查看nginx是否啟動 Apr 14, 2025 pm 12:48 PM

在 Linux 中,使用以下命令檢查 Nginx 是否已啟動:systemctl status nginx根據命令輸出進行判斷:如果顯示 "Active: active (running)",則 Nginx 已啟動。如果顯示 "Active: inactive (dead)",則 Nginx 已停止。

linux怎麼啟動nginx linux怎麼啟動nginx Apr 14, 2025 pm 12:51 PM

在 Linux 中啟動 Nginx 的步驟:檢查 Nginx 是否已安裝。使用 systemctl start nginx 啟動 Nginx 服務。使用 systemctl enable nginx 啟用在系統啟動時自動啟動 Nginx。使用 systemctl status nginx 驗證啟動是否成功。在 Web 瀏覽器中訪問 http://localhost 查看默認歡迎頁面。

怎麼解決nginx跨域問題 怎麼解決nginx跨域問題 Apr 14, 2025 am 10:15 AM

解決 Nginx 跨域問題有兩種方法:修改跨域響應頭:添加指令以允許跨域請求,指定允許的方法和頭,以及設置緩存時間。使用 CORS 模塊:啟用模塊並配置 CORS 規則,允許跨域請求、方法、頭和設置緩存時間。

怎麼啟動nginx服務器 怎麼啟動nginx服務器 Apr 14, 2025 pm 12:27 PM

啟動 Nginx 服務器需要按照不同操作系統採取不同的步驟:Linux/Unix 系統:安裝 Nginx 軟件包(例如使用 apt-get 或 yum)。使用 systemctl 啟動 Nginx 服務(例如 sudo systemctl start nginx)。 Windows 系統:下載並安裝 Windows 二進製文件。使用 nginx.exe 可執行文件啟動 Nginx(例如 nginx.exe -c conf\nginx.conf)。無論使用哪種操作系統,您都可以通過訪問服務器 IP

See all articles