Skip to content

How to disable NGINX access logs in Docker container logs #94

Answered by zionsg
zionsg asked this question in Q&A
Discussion options

You must be logged in to vote

Realized my mistake - missed out the -i option for sed which updates the Nginx configuration file with the new text.

For those who have come here, here's the contents of my Dockerfile for future reference

##
# Dockerfile
##

# Base image - see https://github.com/serversideup/docker-php
FROM serversideup/php:8.1-fpm-nginx

# Disable PHP-FPM and Nginx logs so that they will not clutter up Docker
# container logs and make it hard to sift out the application logs which are
# also output to Docker container logs via stdout
RUN echo "access.log = /dev/null" >> /etc/php/current_version/fpm/pool.d/www.conf
RUN sed --in-place 's/\(access\|error\)_log .*/\1_log \/dev\/null;/' /etc/nginx/nginx.conf
…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jaydrogers
Comment options

@TRONJon
Comment options

@jaydrogers
Comment options

@snoek09
Comment options

Answer selected by zionsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants