Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running nginx 1.3.5 under windows seven, I need to execute nginx directly from a read-only media (CD or DVD), but when I want to run it, it fails with this error:

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)

where J is my CD-ROM drive letter.
I've changed nginx.conf to disable logging completely, but seems anyway it still tries to build a file named 'error.log' in '/logs' folder & some extra temporary contents in '/temp' folder at the startup, so I want to change 'logs' & 'temp' directory path to windows temp folder (%temp%), but I dont have any idea that how can I do it.
Also I want to know why nginx still creates 'logs/error.log' after disableing error logging ?

share|improve this question

migrated from stackoverflow.com Aug 30 '12 at 18:30

This question came from our site for professional and enthusiast programmers.

2 Answers 2

http://nginx.org/en/docs/http/ngx_http_log_module.html lists the directives for controlling logging, specifcally you have the 2 following:

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

and

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 

so while you can completely disable the access_log, the same doesn't seem to be true for the error_log. Nevertheless you can still achieve the effect you want by adding the following to your nginx config;

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

UPDATE: just noticed the windows tag, see this question for the windows /dev/null equivalent

share|improve this answer

as far as i know you can disable access logs but not errors ones. Nginx is trying to create/write messages into log file which is located on the CD/DVD. Try to set log directory into the HD partition, say C: or D:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.