nginx : access.log and error.log file empty

后端 未结 3 730
别跟我提以往
别跟我提以往 2021-02-12 03:45

I have just installed nginx on Ubuntu 14.04 using the command

sudo apt-get install nginx

Now, when I open my browser and type in the address

相关标签:
3条回答
  • 2021-02-12 04:08

    I had the same issue after reinstalling nginx to newer version. Seems like log files ownership changed and new nginx couldn't save anything there.

    Removing log files and reloading nginx worked for me:

    $ sudo rm -f /var/log/nginx/*
    $ sudo nginx -s reload
    
    0 讨论(0)
  • 2021-02-12 04:08

    It looks like by default they are set to go to stdout and stderr.

    lrwxrwxrwx  1 root root   11 Apr 27  2016 access.log -> /dev/stdout
    lrwxrwxrwx  1 root root   11 Apr 27  2016 error.log -> /dev/stderr
    

    So you can remove the symlinks and should be fine.

    rm -f /var/log/nginx/*
    
    0 讨论(0)
  • 2021-02-12 04:13

    For all of those whose, like me, came here to figure out why the logs file are empty, and did not realise that you might actually be inside a docker container like one of the comments on another answer suggests, just open a new shell and tail the logs with

    docker logs {your-container-id-here} -f

    0 讨论(0)
提交回复
热议问题