Required Information
- DietPi version |
cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=16
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’ - Distro version |
echo $G_DISTRO_NAME $G_RASPBIAN
bullseye 0 - Kernel version |
uname -a
Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux - SBC model |
echo $G_HW_MODEL_NAME
or (EG: RPi3)
RPi 3 Model B+ (aarch64) - Power supply used | (EG: 5V 1A RAVpower)
5V 3A - SD card used | (EG: SanDisk ultra)
SanDisk 32GB
DietPi v8.16.2 : 15:46 - Thu 04/13/23
Device model : RPi 3 Model B+ (aarch64)
I have brand new DietPi install. I have installed nginx via dietpi-software > search > nginx [85] and let’s encrypt certificates as well via dietpi-launcher
Secure default server works as expected. Can be access from the Internet and locally. Good.
However, I notice nginx logs are automatically deleted every few hours when there is no default setting that should force nginx to act that way.
/etc/nginx/nginx.conf
# /etc/nginx/nginx.conf
user www-data;
# As a thumb rule: One per CPU.
worker_processes 4;
pid /run/nginx.pid;
# Load dynamic modules
include /etc/nginx/modules-enabled/*.conf;
# Maximum file descriptors that can be opened per process
# This should be > worker_connections
worker_rlimit_nofile 100;
events {
worker_connections 50;
}
error_log /var/log/nginx/error.log;
http {
charset utf-8;
# Avoid > 2 MiB upload error: https://github.com/MichaIng/DietPi/issues/546
client_max_body_size 512M;
# Upstream to abstract back-end connection(s) for PHP
upstream php {
server unix:/run/php/php7.4-fpm.sock;
}
# Set the mime-types via the mime.types external file
include mime.types;
# And the fallback mime-type
default_type application/octet-stream;
# Click tracking!
access_log off;
# Hide Nginx version
server_tokens off;
# ~2 seconds is often enough for HTML/CSS, but connections in
# Nginx are cheap, so generally it's safe to increase it
keepalive_timeout 2;
# You usually want to serve static files with Nginx
sendfile on;
tcp_nopush on; # off may be better for Comet/long-poll stuff
tcp_nodelay off; # on may be better for Comet/long-poll stuff
server_name_in_redirect off;
types_hash_max_size 2048;
gzip off;
gzip_http_version 1.0;
gzip_comp_level 1;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/plain
text/x-component
application/javascript
application/json
application/xml
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon;
# This should be turned on if you are going to have pre-compressed copies (.gz) of
# static files available. If not it should be left off as it will cause extra I/O
# for the check. It would be better to enable this in a location {} block for
# a specific directory:
#gzip_static on;
gzip_disable "msie6";
gzip_vary on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-available/default
/etc/nginx/sites-available/default
server {
access_log /var/log/nginx/access.server.log;
listen 80 default_server;
listen [::]:80 default_server;
root /var/www;
index index.php index.html index.htm index.nginx-debian.html;
server_name myserver.com;
include /etc/nginx/sites-dietpi/*.conf;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php(?:$|/) {
include snippets/fastcgi-php.conf;
fastcgi_pass php;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/myserver.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/myserver.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
/etc/logrotate.d/nginx unedited
/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
}
The expected behaviour would be the logs not to be deleted. Even logrotate is not installed, so I can only think maybe there is a dietpi setting causing this issue?
Thank you very much for your feedback in advance.
Regards,