Nginx permission problem [nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)]
Reference (opens in a new tab)
This error typically occurs in alpine
docker image. Since the nginx image already have a user called nginx. We will reuse it.
FROM nginx:alpine
RUN touch /var/run/nginx.pid \
&& chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
COPY --chown=nginx:nginx <your-files> /usr/share/nginx/html
COPY --chown=nginx:nginx <your-nginx-config> /etc/nginx/conf.d/default.conf
USER nginx
...