NGINX /etc/logrotate.d/nginx

Original ๐Ÿ“‹ Debian 9 (Stretch) 18 lines

Works On

Viewing:
Debian 9 (Stretch)
Same on:
Debian 10 (Buster) Debian 11 (Bullseye) Debian 12 (Bookworm) Debian 13 (Trixie) Ubuntu 18.04 LTS (Bionic Beaver) Ubuntu 20.04 LTS (Focal Fossa) Ubuntu 22.04 LTS (Jammy Jellyfish) Ubuntu 24.04 LTS (Noble Numbat)
Other versions:

Details

Size
18 lines
MD5
b29112f9480a70fa7de2729ff39923e2
SHA256
c6f585f3a98e424c30c5208f2f52c8e39665b76744cd5bcc523efdee0a7d69ee

Copy & Paste

curl:
curl https://exampleconfig.com/api/v1/config/original/b29112f9480a70fa7de2729ff39923e2?hint=nginx
wget:
wget -O nginx https://exampleconfig.com/api/v1/config/original/b29112f9480a70fa7de2729ff39923e2?hint=nginx

For AI Agents

You are a DevOps agent. Fetch the default NGINX config for Debian 9 (Stretch) from https://exampleconfig.com/api/v1/config/original/b29112f9480a70fa7de2729ff39923e2?hint=nginx. Compare with my current /etc/logrotate.d/nginx and summarize differences and safe changes.

Copy this prompt into Claude, ChatGPT, or other AI assistants.

/etc/logrotate.d/nginx
/var/log/nginx/*.log {
	daily
	missingok
	rotate 14
	compress
	delaycompress
	notifempty
	create 0640 www-data adm
	sharedscripts
	prerotate
		if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
			run-parts /etc/logrotate.d/httpd-prerotate; \
		fi \
	endscript
	postrotate
		invoke-rc.d nginx rotate >/dev/null 2>&1
	endscript
}

Install NGINX

Alpine Linux

sudo apk add nginx

Debian

sudo apt update && sudo apt install nginx

Red Hat Enterprise Linux

sudo yum install nginx

Ubuntu

sudo apt update && sudo apt install nginx

File Location

File Path
/etc/logrotate.d/nginx
Directory
/etc/logrotate.d/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

FAQ

When should I use this nginx?

Restore it. Compare it. Start clean.

How do I restore NGINX defaults?

Download, replace, restart.

Is nginx safe for production?

Yes. This is exactly what shipped. Safe starting point.

How does this differ from other OS versions?

Defaults change. This one is specific to Debian 9 (Stretch).

Can I use this for NGINX troubleshooting?

Absolutely. Diff this against yours to spot the problem.