nginx配置相关介绍

2019-10-17 21:11:08王旭

proxy_set_header X-Real-IP $remote_addr;  
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
client_max_body_size 10m;  
client_body_buffer_size 128k;  
proxy_connect_timeout 90;  
proxy_send_timeout 90;  
proxy_read_timeout 90;  
proxy_buffer_size 4k;  
proxy_buffers 4 32k;  
proxy_busy_buffers_size 64k;  
proxy_temp_file_write_size 64k;  
}  
#设定查看Nginx状态的地址  
location /NginxStatus {  
stub_status on;  
access_log on;  
auth_basic "NginxStatus";  
auth_basic_user_file conf/htpasswd;  
}  
}  
}


备注:conf/htpasswd 文档的内容用 apache 提供的 htpasswd 工具来产生即可,内容大致如下:
3.) 查看 Nginx 运行状态 输入地址http://192.168.8.1/NginxStatus/ 。
输入验证帐号密码,即可看到类似如下内容:
Active connections: 328
server accepts handled requests
9309 8982 28890
Reading: 1 Writing: 3 Waiting: 324

第一行表示现在活跃的连接数,第三行的第三个数字表示Nginx运行到现在的连接数。