Welcome! Log In Create A New Profile

Advanced

Can't log x-forwarded-for

August 01, 2016 07:28PM
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


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Can't log x-forwarded-for

miky August 01, 2016 07:28PM

Re: Can't log x-forwarded-for

Francis Daly August 02, 2016 04:02AM

Re: Can't log x-forwarded-for

miky August 02, 2016 07:26AM

Re: Can't log x-forwarded-for

Francis Daly August 02, 2016 08:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 241
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready