nginx 的调优

nginx 增加监控状态:

vim /usr/local/nginx/conf/nginx.conf

location /nginx-status{
stub_status on; //所有的访问,都会被记录在访问日志里
# allow 192.168.0.0/16;
#deny all;
access_log off;
}

location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/var/run/php-fpm.sock;

检查nginx的语法:
/usr/local/nginx/sbin/nginx -t

重起nginx服务:
systemctl reload nginx

浏览器访问测试:
192.168.1.20/nginx-status

这里写代码片
Active connections: 3 
server accepts handled requests
 10 10 4 
Reading: 0 Writing: 1 Waiting: 2 
`
php-fpm的状态检测:
vim /usr/local/php/etc/php-fpm.d/www.conf
pm.status_path = /status     //把这一行的注释打开

重器php-fpm服务:
systemctl  restart php-fpm

浏览器访问测试:
192.168.1.20/status  //返回是404的报错的页面

原因在于 /status  转换不了给nginx的php处理;
查看一下nginx的配置文件的正则表达:
location ~ \.php$ {
            root           html;

只有以php结尾的才可以交给nginx处理

把php-fpm服务修改:
vim /usr/local/php/etc/php-fpm.d/www.conf
pm.status_path = /status .php    //把这一行的注释打开


重起php-fpm服务:
[root@pxe ~]# systemctl  restart php-fpm

浏览器访问:
http://192.168.1.20/status.php

pool:                 www
process manager:      ondemand
start time:           04/Sep/2018:15:01:35 +0800
start since:          9
accepted conn:        1
listen queue:         0
max listen queue:     0
listen queue len:     128
idle processes:       0
active processes:     1
total processes:      1
max active processes: 1
max children reached: 0
slow requests:        0

[root@apache conf.d]# pwd
/etc/httpd/conf.d

vim info.conf

这里写代码片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维螺丝钉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值