我使用的是 nginx 版本:nginx/1.11.8
我的码头文件看起来像:
FROM nginx
COPY website /usr/share/nginx/html/website/
RUN chown -R nginx /usr/share/nginx/html
RUN chown -R nginx /var/log/nginx/
EXPOSE 80
我正在为我的访问日志名称使用变量,如下所示。在没有安装到主机上的目录的情况下运行时,这可以正常工作并生成日志。
location / {
try_files $uri /index.html;
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") { set $year $1; set $month $2; set $day $3; }
access_log /var/log/nginx/nginx.$hostname.$year-$month-$day.log logs;
}
我的主机日志目录是 owner:steve group:logs
如果我从访问日志名称中删除变量,那么它会正确记录到主机目录,即
access_log /var/log/nginx/nginx.novars.log logs;
我是否遗漏了一些明显的东西来让它使用变量来工作?