Tiny Core Linux
Tiny Core Extensions => TCE Bugs => Topic started by: Zhe on February 12, 2026, 10:42:09 AM
-
core x86 16.x nginx /var/log/nginx should be a directory. right?
/var/log/nginx is file ## wrong way?
sudo nginx
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (20: Not a directory)
sudo nginx -c /usr/local/etc/nginx/nginx.conf
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (20: Not a directory)
sudo nginx -t -c /usr/local/etc/nginx/nginx.conf -e /tmp/nginx_error.log ## pass .
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
##########
/var/log/nginx/ is directory now
sudo rm -rf /var/log/nginx
sudo mkdir -p /var/log/nginx
sudo nginx -t -c /usr/local/etc/nginx/nginx.conf
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/log/nginx" failed (21: Is a directory)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
sudo nginx -t -c /usr/local/etc/nginx/nginx.conf -e /tmp/nginx_error.log
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/log/nginx" failed (21: Is a directory)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
-
Hi Zhe
I briefly fired up nginx under TC16 x86. These were my results:
tc@box:~$ ls -l /var/log/
total 212
-rw-r--r-- 1 root staff 58837 Feb 12 21:41 Xorg.0.log
-rw-r--r-- 1 root root 0 Feb 12 21:40 autologin
-rw-r--r-- 1 root root 148079 Feb 12 21:42 messages
drwxr-xr-x 2 root root 40 Dec 12 02:09 nginx/
-rw-rw-r-- 1 root staff 2304 Feb 12 21:42 wtmp
tc@box:~$
tc@box:~$ sudo nginx
nginx: [emerg] open() "/usr/local/etc/nginx/nginx.conf" failed (2: No such file or directory)
tc@box:~$ ls -l /var/log/
total 212
-rw-r--r-- 1 root staff 58837 Feb 12 21:41 Xorg.0.log
-rw-r--r-- 1 root root 0 Feb 12 21:40 autologin
-rw-r--r-- 1 root root 148201 Feb 12 21:45 messages
drwxr-xr-x 2 root root 60 Feb 12 21:45 nginx/
-rw-rw-r-- 1 root staff 2304 Feb 12 21:42 wtmp
tc@box:~$ ls -l /var/log/nginx/
total 4
-rw-r--r-- 1 root root 118 Feb 12 21:45 error.log
tc@box:~$
It shows /var/log/nginx is a directory.
-
Try posting your nginx.conf file.
-
Hi andyj
That was directed at Zhe, right?
-
Hi Rich. When it’s a directory, the configuration check fails.
Hi,andyj
my nginx.conf:
user tc staff;
worker_processes 1;
error_log /tmp/nginx_error.log warn;
pid /tmp/nginx.pid;
events {
worker_connections 512;
}
http {
include mime.types;
default_type application/octet-stream;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/javascript
application/json
application/javascript
application/xml+rss
image/svg+xml;
client_body_temp_path /tmp/nginx/client;
server_tokens off;
server {
listen 80;
listen [::]:80;
server_name xxxxx;
return 301 https://$host:xxx$request_uri ;
}
server {
listen xxx ssl;
listen [::]:xxx ssl;
http2 on;
server_name xxxxx;
root /xxxx/web;
index index.html;
charset utf-8;
autoindex off;
ssl_certificate /etc/xxxx/server-cert.pem;
ssl_certificate_key /etc/xxxx/server-key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
add_header X-Content-Type-Options "nosniff";
add_header Referrer-Policy "no-referrer-when-downgrade" always;
if ($request_method !~ ^(GET|HEAD|OPTIONS)$ ) {
return 405;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.\. {
deny all;
return 403;
}
........
}
}
-
my nginx.conf works fine when /var/log/nginx is a file.
I suspect the problem might lie elsewhere—it could be that different versions of Nginx lead to different behaviors, or it might be a compilation issue.
-
From the Makefile:
objs/Makefile: test -d '$(DESTDIR)/var/log/nginx' \
objs/Makefile: || mkdir -p '$(DESTDIR)/var/log/nginx'
What I don't see is where you are using this path anywhere. It may be that there is a default behavior that is looking for "/var/log/nginx/whatever.log", but when there is no "whatever.log" then what is being checked is "/var/log/nginx" and because "nginx" is the last thing in the path it is being interpreted as a file and not as the directory that it is.
The configured error log path is "--error-log-path=/var/log/nginx/error.log", but "--http-log-path=/var/log/nginx" is given as a directory path and not a file name so it could be misinterpreted as above. I can recompile it with something like "--http-log-path=/var/log/nginx/access.log" and see if that changes what you are seeing.
-
Hi andyj
I ran through it again and can confirm Zhes findings.
Start with a clean /var/log directory:
tc@box:~$ ls -l /var/log
total 208
-rw-r--r-- 1 root staff 58837 Feb 13 10:09 Xorg.0.log
-rw-r--r-- 1 root root 0 Feb 13 10:09 autologin
-rw-r--r-- 1 root root 147372 Feb 13 10:09 messages
-rw-rw-r-- 1 root staff 1536 Feb 13 10:09 wtmp
Load nginx:
tc@box:~$ tce-load -i nginx
nginx.tcz: OK
The /var/log/nginx directory is part of the nginx.tcz file structure:
tc@box:~$ ls -l /var/log
total 212
-rw-r--r-- 1 root staff 58837 Feb 13 10:09 Xorg.0.log
-rw-r--r-- 1 root root 0 Feb 13 10:09 autologin
-rw-r--r-- 1 root root 148146 Feb 13 10:12 messages
drwxr-xr-x 2 root root 40 Dec 12 02:09 nginx/
-rw-rw-r-- 1 root staff 1536 Feb 13 10:09 wtmp
/var/log/nginx is empty:
tc@box:~$ ls -l /var/log/nginx
total 0
Version and configure options:
tc@box:~$ nginx -V
nginx version: nginx/1.29.4
built by gcc 14.2.0 (GCC)
built with OpenSSL 3.5.2 5 Aug 2025
TLS SNI support enabled
configure arguments: --prefix=/usr/local --sbin-path=/usr/local/sbin/nginx --modules-path=/usr/local/lib/nginx/modules --conf-path=/usr/local/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/tmp/nginx/lock --user=nobody --group=nogroup --with-threads --with-file-aio --with-compat --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --http-log-path=/var/log/nginx --http-client-body-temp-path=/tmp/nginx/client --http-proxy-temp-path=/tmp/nginx/proxy --http-fastcgi-temp-path=/tmp/nginx/fastcgi --http-uwsgi-temp-path=/tmp/nginx/uwsgi --http-scgi-temp-path=/tmp/nginx/scgi --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module
Copy all of the .default files to the nginx config directory:
tc@box:~$ sudo cp /usr/local/etc/nginx/original/*.default /usr/local/etc/nginx/
Strip the .default extension from those files:
tc@box:~$ for F in /usr/local/etc/nginx/*.default; do sudo mv -- "$F" "${F%.default}"; done
Try to start nginx:
tc@box:~$ sudo nginx
nginx: [emerg] open() "/var/log/nginx" failed (21: Is a directory)
One slight twist. The file was written:
tc@box:~$ ls -l /var/log/nginx
total 4
-rw-r--r-- 1 root root 91 Feb 13 10:33 error.log
tc@box:~$ cat /var/log/nginx/error.log
2026/02/13 10:33:54 [emerg] 3920#3920: open() "/var/log/nginx" failed (21: Is a directory)
-
Hi andyj
Could it be this part from nginx -V:
--http-log-path=/var/log/nginx
I saw it configured in a build tutorial as:
--http-log-path=/var/log/nginx/access.log