Can't log x-forwarded-for

Mik J mikydevel at yahoo.fr
Mon Aug 1 23:25:46 UTC 2016


nginx version: nginx/1.9.10

Hello,I'm trying to log the client IP within the x-forwarded-for field.
http://nginx.org/en/docs/http/ngx_http_log_module.html
The only problem is that I think I followed the instructions correctly but nginx won't start# nginx
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"';...
In sites-available/default I haveaccess_log /var/log/nginx/default.access.log main; <= This is line 8
error_log /var/log/nginx/default.error.log main;
i think I did things good but it's like the line in nginx.conf is not taken into account
Do you know why ?
Regards


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160801/8614b5bd/attachment.html>


More information about the nginx mailing list