Control Web Panel
WebPanel => CentOS-WebPanel GUI => Topic started by: turkoy on January 24, 2016, 07:26:12 PM
-
ex. Server ip adress : 123.123.123.123
Any visitors IP address: 123.123.123.123
the same IP address of all visitors why?
please help :( :(
-
Are you running varnish? It does that out of the box, you need to configure it to pass the IP back in a custom header then tell apache to log that header instead of the IP. There's a discussion of how to do that here:
http://forum.centos-webpanel.com/apache/website-server-logs-wordpress-etc/
-
Yes running varnish ?
-
The client makes an http request to your domain and gets directed to the varnish server, which is mostly transparent to the end user. The varnish server checks its cache and if it has the file it serves it. If not it asks the apache server for the file. The apache server knows nothing about the end user unless you tell varnish to tell apache about it. You can't pass the client's ip straight through because apache can't reply directly back to the client, the client will drop the packets, so you set up a custom field that has the client's ip in it. Now all you have to do is tell Apache to log that field instead of the IP and you're in business.
The link I mentioned above explains how to do this, but unless you're will to spend some time learning how to configure varnish there's not much point to running it.
-
Thanks for the reply.
However, some modes can handle it. I think.
This code does not solve the problem
if (req.restarts == 0) {
if (req.http.X-Forwarded-For) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}
However, I think I need php module?
This does not solve the problem? How did you solve first?
regards
-
I use:
sub vcl_recv { include "/etc/varnish/sites.vcl";
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
[insert the rest of your vcl_recv]
}
This alone won't work because all you're doing is passing the info to apache, you also have to tell apache to log it:
In /usr/local/conf/httpd.conf
change your logging format to:
LogFormat "%{X-Forwarded-For}i %l %u %t %v \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
and make sure it says "combined" after your logging path:
CustomLog "/usr/local/apache/logs/access_log" combined
restart apache (service httpd restart)
-
I use:
sub vcl_recv { include "/etc/varnish/sites.vcl";
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
[insert the rest of your vcl_recv]
}
This alone won't work because all you're doing is passing the info to apache, you also have to tell apache to log it:
In /usr/local/conf/httpd.conf
change your logging format to:
LogFormat "%{X-Forwarded-For}i %l %u %t %v \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
and make sure it says "combined" after your logging path:
CustomLog "/usr/local/apache/logs/access_log" combined
restart apache (service httpd restart)
I made the corrections as you said.
however, the situation looks the same server as the IP address of the user. :( :( :( :(
-
Hello.
That is Varnish trouble... You can see real IP in an access log files.