On Mon, Aug 01, 2016 at 11:25:46PM +0000, Mik J wrote: Hi there,
> nginx: [emerg] unknown log format "main" in /etc/nginx/sites-enabled/default:8 > > in nginx.conf I havehttp { > include mime.types; > include /etc/nginx/sites-enabled/*; > include /etc/nginx/conf.d/*; > default_type application/octet-stream; > index index.html index.htm; > log_format main '$remote_addr forwarded for $http_x_real_ip - > $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' > '"$http_referer" "$http_user_agent"';... Look at the order of config lines there. You have, effectively, http { server { access_log /tmp/out.log main; } log_format main '$remote_addr $request'; } and nginx complains that "main" is not defined at the "access_log" line. > i think I did things good but it's like the line in nginx.conf is not taken > into account > Do you know why ? If you put the "log_format" line before the "server" block (i.e., before the appropriate "include" line), nginx will probably be happier. Arguably, since "log_format" is at http-level only, and you can't repeat "name", nginx *could* be able to handle things out of order. But right now it doesn't, so the quick fix is to re-order things yourself. Cheers, f -- Francis Daly fran...@daoine.org _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx