<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div dir="ltr" id="yui_3_16_0_ym19_1_1470092713478_3927">nginx version: nginx/1.9.10<br id="yui_3_16_0_ym19_1_1470092713478_3969"></div><div id="yui_3_16_0_ym19_1_1470092713478_4197" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4297" dir="ltr">Hello,</div><div id="yui_3_16_0_ym19_1_1470092713478_4198" dir="ltr">I'm trying to log the client IP within the x-forwarded-for field.</div><div id="yui_3_16_0_ym19_1_1470092713478_4320" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4055" dir="ltr"><a id="yui_3_16_0_ym19_1_1470092713478_4328" href="http://nginx.org/en/docs/http/ngx_http_log_module.html">http://nginx.org/en/docs/http/ngx_http_log_module.html</a><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4056" dir="ltr">The only problem is that I think I followed the instructions correctly but nginx won't start</div><div id="yui_3_16_0_ym19_1_1470092713478_4057" dir="ltr"># nginx<br id="yui_3_16_0_ym19_1_1470092713478_4027">nginx: [emerg] unknown log format "main" in /etc/nginx/sites-enabled/default:8<br id="yui_3_16_0_ym19_1_1470092713478_4028"></div><div id="yui_3_16_0_ym19_1_1470092713478_4058" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4059" dir="ltr">in nginx.conf I have</div><div id="yui_3_16_0_ym19_1_1470092713478_4060" dir="ltr">http {<br id="yui_3_16_0_ym19_1_1470092713478_4073"> include mime.types;<br id="yui_3_16_0_ym19_1_1470092713478_4074"> include /etc/nginx/sites-enabled/*;<br id="yui_3_16_0_ym19_1_1470092713478_4075"> include /etc/nginx/conf.d/*;<br id="yui_3_16_0_ym19_1_1470092713478_4076"> default_type application/octet-stream;<br id="yui_3_16_0_ym19_1_1470092713478_4077"> index index.html index.htm;<br id="yui_3_16_0_ym19_1_1470092713478_4078"> 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"';</div><div id="yui_3_16_0_ym19_1_1470092713478_4106" dir="ltr">...</div><div id="yui_3_16_0_ym19_1_1470092713478_4200" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4201" dir="ltr">In sites-available/default I have</div><div id="yui_3_16_0_ym19_1_1470092713478_4202" dir="ltr">access_log /var/log/nginx/default.access.log main; <= This is line 8<br></div><div id="yui_3_16_0_ym19_1_1470092713478_4212" dir="ltr">error_log /var/log/nginx/default.error.log main;</div><div id="yui_3_16_0_ym19_1_1470092713478_4362" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4375" dir="ltr">i think I did things good but it's like the line in nginx.conf is not taken into account</div><div id="yui_3_16_0_ym19_1_1470092713478_4384" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4393" dir="ltr">Do you know why ?</div><div id="yui_3_16_0_ym19_1_1470092713478_4394" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1470092713478_4395" dir="ltr">Regards<br></div><div id="yui_3_16_0_ym19_1_1470092713478_4363" dir="ltr"><br></div><div dir="ltr"><br></div></div></body></html>