macsplex.com 로그인

검색

Debian
2018.09.10 02:58

Nginx 이미지링크 방지

조회 수 345 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
Extra Form
출처/참고/홈페이지 https://nginxlibrary.com/hotlink-protection/

다른사이트에서 이미지파일을 링크를 걸어둘시 트래픽폭탄에 대비해서 nginx에 설정하는 방법입니다.


해당이미지는 다른사이트에서는 보여지지 않습니다.


데비안 9인 경우 /etc/nginx/sites-enabled/default 파일에 server 부분에 다음을 추가합니다.


location ~* \.(jpg|jpeg|png|gif)$ { 
        valid_referers none blocked www.macsplex.com macsplex.com;                              
        if ($invalid_referer) { return 403; } 
}


해당 주소에 맞게 macsplex.com부분을 자신에 맞게 수정합니다.


막고싶은 확장자가 있으면 jpg 부분에 해당확장자를 추가하면 됩니다.


해당이미지 링크시 원하는 이미지를 보여주고 싶다면 해당 아래코드를 집어넣어주세요


location ~* \.(jpg|jpeg|png|gif)$ {
                valid_referers none blocked www.macsplex.com macsplex.com;

                        if ($invalid_referer) {
                                rewrite ^(.*)$ /block_hotlink.jpg break;
                        }
        }
        location =/block_hotlink.jpg {
                root /home/macsplex.com/www/block_hotlink.jpg;
        }
출처 :[AllAtD]

본인에 맞게 수정을 해주시면 됩니다.

location ~* \.(jpg|jpeg|png|gif)$ { valid_referers none blocked www.mydomain.com mydomain.com; if ($invalid_referer) { return 403; } }

출처: [AllAtD]
location ~* \.(jpg|jpeg|png|gif)$ { valid_referers none blocked www.mydomain.com mydomain.com; if ($invalid_referer) { return 403; } }

출처: http://allatd.tistory.com/entry/Nginx-Hotlink-이미지-외부-링크-막기 [AllAtD]




--------------------------------------------------광고(Advertising)-------------------------------------------------------------------------------------


TAG •

리눅스 Tip

Linux Tip

  1. nginx rewrite 예제

    Categorynginx
    Read More
  2. nginx semrush bot 차단

    Categorynginx
    Read More
  3. Ngnix 특정폴더 인증절차추가

    CategoryDebian
    Read More
  4. 웹로그분석툴 GoAccess

    CategoryDebian
    Read More
  5. 워드프레스 고유주소 nginx 설정

    CategoryDebian
    Read More
  6. nginx "rewrite" directive is not allowed here in 에러발생시

    CategoryDebian
    Read More
  7. CentOS 8 웹콘솔(Cokpit) 설치하기

    CategoryCentOS
    Read More
  8. 우분투 18.04 영문판에서 한글입력 추가

    CategoryUbuntu
    Read More
  9. yarn 설치방법

    CategoryFedora
    Read More
  10. sudo 유저추가

    CategoryFedora
    Read More
  11. VMware Remote-Console 설치 에러

    CategoryFedora
    Read More
  12. 리눅스 민트 19.1 테사(Tessa) 업그레이드 방법

    CategoryLinuxmint
    Read More
  13. Arch 저장소(repo)추가 방법

    CategoryArch
    Read More
  14. Gzip 압축효율 확인사이트

    Read More
  15. Nginx 이미지링크 방지

    CategoryDebian
    Read More
  16. Nginx사용시 업로드용량변경

    CategoryDebian
    Read More
  17. Mysql(MaridaDB)접속시 ERROR 2002 발생시

    CategoryDB
    Read More
  18. apache2 ssl 모드 활성 및 비활성화 명령어

    CategoryApache2
    Read More
  19. 페도라 방화벽포트열기

    CategoryFedora
    Read More
  20. 페도라에서 VLC를 설치하고 싶을때

    CategoryFedora
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8