로그인

검색

Extra Form
추천지수 6

클라우드플레어를 사이트에 적용하면 클라우드플레어를 통해서 방문자들이 접속하기 때문에 모두 클라우드플레어의 ip로 접근되어 문제가 발생할 수 있습니다. 방문자를 특정할 수 없는 문제와 또 같은 ip로 할수 없는 것들이 모두 제한됩니다. 그래서 방문자의 실제 ip로 서버에서 처리될 수 있도록 해야 합니다.

 

 현재 배포되는 우분투 등 nginx 를 사용하면 별다른 설치 없이 설정만 추가해서 간단하게 처리가 가능합니다.

 

https://support.cloudflare.com/hc/ko/articles/200170786-%EC%9B%90%EB%9E%98-%EB%B0%A9%EB%AC%B8%EC%9E%90%EC%9D%98-IP-%EB%B3%B5%EC%9B%90-mod-cloudflare%EB%A1%9C-%EB%B0%A9%EB%AC%B8%EC%9E%90-IP-%EC%A3%BC%EC%86%8C-%EB%A1%9C%EA%B7%B8-%EA%B8%B0%EB%A1%9D-

 

위 링크의 설명에 따라서 적용하면 되는데 우분투 18.04 / nginx 를 사용하는 저희 서버에 적용한 것으로 간단하게 설명을 드리겠습니다.

 

 

 

set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;

#use any of the following two

real_ip_header CF-Connecting-IP;
#real_ip_header X-Forwarded-For;

 

nginx 설정에 위 내용이 포함되도록 해주면 됩니다.  맨 아래 2개의 방법 중 아무거나 하나를 사용하라고 되어 있고 하나는 주석이 되어 있으니 그냥 저대로 그대로 붙여넣으셔도 됩니다.

 

 

그럼 어디에 저 내용을 붙여넣을 까요?

 

저희 서버 기준으로 

etc/nginx/conf.d/  이 폴더에 새로운 파일 하나를 만들고 저 내용을 붙여넣어 주시면 됩니다.

 

위 폴더에 .conf 확장자의 파일을 만들고 내용을 넣어주면 자동으로  nginx.conf 에서 불러오므로 따로 include를 하지 않아도 됩니다.

 

파일명을 cloudflare.conf 와 같은 것으로 만들고 위 내용을 붙여넣기 하여 저장을 하면 됩니다.

 

 

그리고

 

nginx - t  로 테스트를 한번 해보시고

nginx -s reload 로 한번 재설정을 해주면 적용이 바로 됩니다.

Who's 꿀팁관리소장

profile
라이믹스로 커뮤니티 사이트를 운영하는 비개발자 운영자 입니다.
파트너쉽 맺으실 사이트 운영자분 환영합니다.
2 추천

자유게시판(68)

주제를 정하지 않은 가벼운 이야기 들입니다.

  1. read more
  2. 이녀석 또 뭐야.... 91.240.118.182 3

    Date2022.12.22 Views1192 Votes3
    Read More
  3. Read More
  4. Read More
  5. Read More
  6. Read More
  7. Read More
  8. Read More
  9. Read More
  10. Read More
  11. Read More
  12. Read More
  13. Read More
  14. 파이코인 앱 설치 및 가입 방법 5

    Date2021.12.30 Views474 Votes2
    Read More
  15. Read More
  16. Read More
  17. Read More
  18. Read More
  19. Read More
  20. Read More
  21. Read More
Prev 1 2 3 4 Next
/ 4