Tiny Core Extensions > TCE Bugs

nginx log path ---core x86 16.x

(1/2) > >>

Zhe:
core x86 16.x  nginx  /var/log/nginx should be a directory. right?


--- Code: ---/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
--- End code ---

Rich:
Hi Zhe
I briefly fired up nginx under TC16 x86. These were my results:

--- Code: ---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:~$
--- End code ---

It shows  /var/log/nginx  is a directory.

andyj:
Try posting your nginx.conf file.

Rich:
Hi andyj
That was directed at Zhe, right?

Zhe:
Hi Rich. When it’s a directory, the configuration check fails.

Hi,andyj

my nginx.conf:

--- Code: ---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;
        }

........

    }
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version