VirtualDocumentRoot with 1.4.2
Maxim Dounin
mdounin at mdounin.ru
Tue Aug 27 11:32:29 UTC 2013
Hello!
On Tue, Aug 27, 2013 at 04:43:12PM +0800, Kai Hendry wrote:
> Hi there,
>
> I've tried to replicate my Apache VirtualDocumentRoot /srv/www/%0 to
> nginx.
>
> I have http://dabase.com/e/04055/ with
>
> server_name ~^(?<vhost>.*)$;
> root /srv/www/$vhost;
> access_log /var/log/nginx/$vhost.access.log;
>
> However it's still logging to /var/log/nginx/access.log instead of
> /var/log/nginx/$vhost.access.log.
>
> [root at sg ~]# cd /var/log/nginx/
> [root at sg nginx]# inotifywait -r -m .
> Setting up watches. Beware: since -r was given, this may take a while!
> Watches established.
> ./ MODIFY access.log
> ./ MODIFY access.log
>
> `root /srv/www/$vhost;` works, but not `access_log
> /var/log/nginx/$vhost.access.log;`.
>
> What am I missing?
http://nginx.org/r/access_log
: The file path can contain variables (0.7.6+), but such logs have some
: constraints:
:
: - the user whose credentials are used by worker processes should have
: permissions to create files in a directory with such logs;
:
: - buffered writes do not work;
:
: - the file is opened and closed for each log write. However, since the
: descriptors of frequently used files can be stored in a cache, writing to the
: old file can continue during the time specified by the open_log_file_cache
: directive’s valid parameter
:
: - during each log write the existence of the request’s root directory is
: checked, and if it does not exist the log is not created. It is thus a good
: idea to specify both root and access_log on the same level:
--
Maxim Dounin
http://nginx.org/en/donation.html
More information about the nginx
mailing list