keepalive_timeout參數是一個請求完成之后還要保持連接多久,不是請求時間多久,目的是保持長連接,減少創建連接過程給系統帶來的性能損耗,類似於線程池,數據庫連接池。
[root@web01 ~]# cat /application/nginx/conf/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';