Valian / docker-nginx-auto-ssl

Docker image for automatic generation of SSL certs using Let's encrypt and Open Resty
https://hub.docker.com/r/valian/docker-nginx-auto-ssl/
MIT License
411 stars 103 forks source link

Can't read nginx log files #24

Closed Razkaroth closed 5 years ago

Razkaroth commented 5 years ago

Hello, thanks for your work in this image.

I was trying to add some fail2ban filters to a custom image. I found the acces.log file under /usr/local/openresty/nginx/conf/logs/ but I can't see its content. Using vim to read the file outputs 'access.log' is not a regular file. And I can't find any other log files inside the container.

Any help is really appreciated. Raz.

Valian commented 5 years ago

Hi @Razkaroth!

You have this problem, because openresty image used as a base for this image, has the following line: https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile#L110. Basically, access log and error log from these files are forwarded directly to connected stdout and stderr.

I'm pretty sure you need to add access_log and error_log directives like in this example https://docs.nginx.com/nginx/admin-guide/monitoring/logging/. Use non-default values and it should work.