1、配置文件
#vim /usr/local/nginx/conf/nginx.conf
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile 20480;
events {
use epoll;
worker_connections 20480;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
…………….
2、說明
$remote_addr 與$http_x_forwarded_for 用以記錄客戶端的ip地址;
$remote_user :用來記錄客戶端用戶名稱;
$time_local : 用來記錄訪問時間與時區;
$request : 用來記錄請求的url與http協議;
$status : 用來記錄請求狀態;成功是200,
$body_bytes_s ent :記錄發送給客戶端文件主體內容大小;
$http_referer :用來記錄從那個頁面鏈接訪問過來的;
$http_user_agent :記錄客戶毒啊瀏覽器的相關信息;