Using dynamic access_log, automatically create parent directory

justink101 nginx-forum at
Mon Jul 27 02:49:01 UTC 2015

We use a dynamic value for access logs:

    access_log /var/log/nginx/domains/$host/access.log main;

However, if the $host directory does not exist in /var/log/nginx/domains
nginx fails with an error creating the access log. Is there a way to have
nginx create the $host directory automatically instead of failing?

Seems like this should be default behavior?

Posted at Nginx Forum:,260563,260563#msg-260563

More information about the nginx mailing list