NGINX /etc/logrotate.d/nginx

Original 📋 Red Hat Enterprise Linux 8 (Ootpa) 13 lines
/etc/logrotate.d/nginx
/var/log/nginx/*log {
    create 0664 nginx root
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

Copy & Paste

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

For AI Agents

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/7c96eb33f2a56b46930c9476067e9ac0?hint=nginx' /><config><app>NGINX</app><os>Red Hat Enterprise Linux 8 (Ootpa)</os><location>/etc/logrotate.d/nginx</location><lines>13</lines><md5>7c96eb33f2a56b46930c9476067e9ac0</md5><sha256>c129c1b7101d25df8f7b953525eac20a1b81404d6a24232e190f1b500ff03f04</sha256></config></prompt>

Paste into Claude, ChatGPT, or any AI assistant.

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?

Use it to restore a missing default, confirm what shipped, or diff against your current NGINX config.

How do I restore NGINX defaults?

Download the file, back up the current one in /etc/logrotate.d/nginx, replace it, then reload or restart NGINX.

Is nginx safe for production?

It is the vendor default for Red Hat Enterprise Linux 8 (Ootpa). Treat it as a baseline and review security and performance settings before production use.

How does this differ from other OS versions?

Defaults vary by distro and version. This copy matches Red Hat Enterprise Linux 8 (Ootpa).

Can I use this for NGINX troubleshooting?

Yes. Diff it against yours to find drift, then restore only the sections you need.