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 ?


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


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


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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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