Nginx 접근 로그(accesslog)설정
3519 단어 수송 하 다.
log_format\#로 그 를 기록 하 는 형식 을 정의 합 니 다.(다양한 로그 형식 을 정의 할 수 있 고 이름 을 바 꾸 면 됩 니 다.)
access_log\#일부 파일 의 경로 와 사용 할 로그 형식 기록 로 그 를 지정 합 니 다.
lof_format 의 기본 값:
# log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
access_log 의 기본 값:
#access_log logs/access.log main;
log_format 문법 형식 및 매개 변수 문법 설명 은 다음 과 같 습 니 다.
log_format ;
: error_log
:
:
log_format :
$remote_addr #
$remote_user #
$time_local #
$request # http
$status #http , , :200、301、404
$body_bytes_sent # body
$http_referer # , 。
$http_user_agent # , : 、
$http_x_forwarded_for # , web , x_forwarded_for
access_log 문법 형식 및 매개 변수 문법 설명 은 다음 과 같 습 니 다.
access_log ;
: error_log
:
:
:
access_log off; # access_log,
access_log path [format [buffer=size [flush=time]] [if=condition]];
access_log path format gzip[=level] [buffer=size] [flush=time] [if=condition];
access_log syslog:server=address[,parameter=value] [format [if=condition]];
:
buffer=size #
flush=time #
gzip[=level] #
[if = condition] #
일반 장면 의 이런 매개 변 수 는 설정 할 필요 가 없고 극단 적 인 최적화 가 있어 야 이런 매개 변 수 를 고려 할 수 있다.
lof_format 매개 변수의 탭 위치:
http
access_log 매개 변수의 탭 위치:
http, server, location, if in location, limit_except
:http://nginx.org/en/docs/http/ngx_http_log_module.html
Nginx 접근 로그 프로 세 스 설정:
(1)log 생 성format 구문
worker_processes 1;
error_log logs/error.log error;
events {
worker_connections 1024;
}
http {
include status.conf;
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"';
access_log logs/access.log main;
server {
listen 80;
server_name localhost;
rewrite ^/.* http://www.wl.com permanent;
}
include vhost/*.conf;
}
(2)access 삽입로그 문
server {
access_log /data/log/www;
listen 80;
server_name abc.com www.wl.com;
location / {
root /data/www/www;
index index.html index.htm;
}
error_log logs/error_www.wl.com.log error;
access_log logs/access_www.wl.com.log main;
# ↑
}
(3)서비스 재 개
nginx -t
nginx -s reload
다음으로 전송:https://www.cnblogs.com/xuyuQAQ/p/8728773.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
셸 입문 부터 정통 한 for 순환 및 6 가지 난수 생 성 법순환 용 1. [문법 구조] 2. 문법 linux 에서 무 작위 수 를 만 드 는 여섯 가지 방법 방법 1: 방법 2: openssl 을 통 해 난수 생 성 방법 3: date 시간 을 통 해 얻 을 수 있 습 니 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.