nginx not starting because of bad/missing path to access_log

Boyko Yordanov b.yordanov at exsisto.com
Fri Oct 7 11:32:53 UTC 2011


Hi,

Just want to point this case where nginx won't start and eventually suggest a feature to avoid this situation.

nginx vhost is configured with the following directive:

        access_log  /domhome/some-random-domain.com/logs/access_log  main;

where /domhome/some-random-domain.com/logs/access_log is in fact a symlink:

# ls -la /domhome/some-random-domain.com/logs/access_log
lrwxrwxrwx 1 root root 46 Oct  2 05:31 /domhome/some-random-domain.com/logs/access_log -> /domhome/some-random-domain.com/logs/2011/10/access_log

The case is that if some folder in the path does not exist, e.g. the folder 2011 is missing, or 10 is missing, then nginx won't be able to follow the symlink and create the access_log. It will just refuse to start with the following error in the log:

2011/10/07 13:21:12 [emerg] 9105#0: open() "/domhome/some-random-domain.com/logs/access_log" failed (2: No such file or directory)
 
Can this behavior be adjusted, so that nginx creates all the folders in the path and create the access_log itself, and start normally as expected? Or is this inappropriate, and if so, why?

Thanks,

Boyko


More information about the nginx mailing list