hashchen
hashchen

Reputation: 1039

Nginx error is not written to my error_log directive

On Ubuntu, when I try to restart my Nginx, I got some errors, but they are not written to my error_log directive, but still to the default /var/log/nginx/error.log My nginx.conf looks something like this:

server {
    listen      80;
    charset     utf-8

    error_log /home/ubuntu/nginxerror.log;

    location / {
        uwsgi_pass  django;
        include     /etc/nginx/uwsgi_params;
        }
    }

I actually have some ideas of this, if you pay attention, you should see I forgot ";" after "charset utf-8", and this is the reason why nginx fails on startup, I guess since the syntax is not correct, nginx config did not successfully load, and all the errors just go to the default log.

Does anyone know why.

Upvotes: 0

Views: 2996

Answers (1)

Dmitry Verhoturov
Dmitry Verhoturov

Reputation: 6082

Easiest way to check if your nginx configuration is using following command: $ nginx -c /etc/nginx/nginx.conf -t

Error in your sites configuration and in in nginx.conf file itself are logging according to error_log directive (docs) in your configuration http section, /var/log/nginx/error.log by default.

Upvotes: 1

Related Questions