状态信息配置
主要用于查看是否了丢失连接数
vim /usr/local/nginx/conf/nginx.conf
#
server {
listen 80;
server_name abc.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/www;
index index.html index.htm;
stub_status on;
access_log off;
}
#
重新加载nginx配置文件
/usr/local/nginx/sbin/nginx -s reload
需要先安装Nginx模块http_stub_status_module
访问结果
Active connections: 1 #活跃的连接数
server accepts handled requests #
1 1 1
Reading: 0 Writing: 1 Waiting: 0
#server :Nginx启动到此时共处理的连接数
#accepts :Nginx启动到此时共成功创建的连接数
#handled requests :Nginx共处理了几次请求
访问控制
server {
listen 80;
server_name abc.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/www;
index index.html index.htm;
deny 192.168.1.1; #禁止单个IP
deny 192.168.0.1/24; #禁止网段
allow all;#允许
access_log off;
}