文件配置nginx.conf
- http {
- server{
- #需要增加的location的地方
- }
例子:
location /nginx_status{
stub_status on;
access_log off;
# allow 172.20.0.112;
# deny all;
auth_basic "NginxStatus";
}
软链接:ln -s /usr/local/nginx/sbin/nginx /usr/bin/
重新编译:
./configure --with-http_stub_status_module
make && make install
查看配置是否正确 ./nginx -t
重启:./nginx -s reload
添加可以访问的IP
allow 语法:
allow address | CIDR | unix: | all;
默认值: — 配置段:
http, server, location, limit_except
禁止访问的IP
deny
语法: deny address | CIDR | unix: | all;
默认值: —
配置段: http, server, location, limit_except