nginx 임시 및 로그 폴더를 변경하거나 로깅을 완전히 비활성화하는 방법

nginx 임시 및 로그 폴더를 변경하거나 로깅을 완전히 비활성화하는 방법

Windows 7에서 nginx 1.3.5를 실행 중입니다. 읽기 전용 미디어(CD 또는 DVD)에서 nginx를 직접 실행해야 하지만 실행하려고 하면 다음 오류가 발생하며 실패합니다.

nginx: [alert] could not open error log file: CreateFile() "logs/error.log" fail
ed (5: Access is denied)
2012/08/28 13:52:46 [emerg] 5604#2864: CreateDirectory() "J:\nginx-1.3.5/temp/client_body_temp" failed (5: Access is denied)

여기서 J는 내 CD-ROM 드라이브 문자입니다.
로깅을 완전히 비활성화하기 위해 nginx.conf를 변경했지만 어쨌든 시작 시 '/logs' 폴더에 'error.log'라는 파일을 만들고 '/temp' 폴더에 추가 임시 콘텐츠를 만들려고 시도하는 것 같습니다. 'logs' 및 'temp' 디렉토리 경로를 Windows 임시 폴더(%temp%)로 변경하고 싶지만 어떻게 해야 할지 모르겠습니다.
또한 오류 로깅을 비활성화한 후에도 nginx가 여전히 'logs/error.log'를 생성하는 이유를 알고 싶습니다.

답변1

http://nginx.org/en/docs/http/ngx_http_log_module.html로깅 제어를 위한 지시문을 나열합니다. 특히 다음 2가지가 있습니다.

syntax:     access_log path [format [buffer=size]]; 
            access_log off;
default:    access_log logs/access.log combined;
context:    http, server, location, if in location, limit_except

그리고

syntax:     error_log file | stderr [debug | info | notice | warn | error | crit | alert | emerg];
default:    error_log logs/error.log error;
context:    main, http, server, location 

따라서 access_log를 완전히 비활성화할 수 있지만 error_log의 경우에는 그렇지 않은 것 같습니다. 그럼에도 불구하고 nginx 구성에 다음을 추가하여 원하는 효과를 얻을 수 있습니다.

error_log /dev/null emerg; #redirect the logging we can't shut off to a black hole;
acces_log off; #disable acces log

업데이트: 방금 windows 태그를 발견했습니다.이 질문Windows의 경우 /dev/null 해당

답변2

내가 아는 한 액세스 로그를 비활성화할 수 있지만 오류 로그는 비활성화할 수 없습니다. Nginx가 CD/DVD에 있는 로그 파일에 메시지를 생성/기록하려고 합니다. C: 또는 D:와 같이 HD 파티션에 로그 디렉터리를 설정해 보십시오.

관련 정보