Sysops Notepad

[Linux] Centos 웹 서버(Apache,Nginx) X-Forwarded-For Log 설정 본문

업무/sys

[Linux] Centos 웹 서버(Apache,Nginx) X-Forwarded-For Log 설정

sysops 2019. 2. 19. 16:20
728x90


Apache

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy

CustomLog logs/access_log proxy


nginx

--with-http_realip_module 모듈 설치 필요 ( nginx -V )


# vi /etc/nginx/nginx.conf 

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                  '$status $body_bytes_sent "$http_referer" '

                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;



참고:

https://belong2jesus.tistory.com/89

https://meetup.toast.com/posts/163

https://blog.whitelife.co.kr/321

728x90
Comments