Updated: 11 October 2026 · Applies to: AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12

Nginx fails to start with "could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)" when its log folder is missing or not writable.

Fix (root)

mkdir -p /var/log/nginx
chown -R nginx:nginx /var/log/nginx      # www-data:www-data on Ubuntu/Debian
nginx -t && systemctl restart nginx

Check which user Nginx runs as with the user line in /etc/nginx/nginx.conf.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)