Kudos
Collect
Twiiter
Facebook
Share
Develop somethings, meditation, reading and thinking...

Nginx 에서 특정 파일의 접속을 제한하는 방법

마지막 업데이트 4년 전
2 0 0 0

웹 서비스를 하면서 사용자가 직접 파일을 액세스하여 내용을보기 원하지 않는 파일들이 있다. 이런 파일들을 Nginx 에서 간단히 접속하지 못하도록 하는 설정 코드.

설정 코드

# 모든 less 및 sass 파일을 제한
location ~ .(less|sass) {
    return 403;
    # or
    # deny all;
}

# 모든 filename.ext 파일을 제한
location ~ filename.ext {
    return 403;
}

$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ service nginx restart
$ _

어떤 분의 퇴근에 도움이 되길 바랍니다.

참고

Hi, my name is Richard. I’m a developer wants to make the world better with logic power. Mainly I use Linux, Nginx, MySQL, PHP and JavaScript . I want to share my knowledge with someone that it was also based from some great persons via LYNMP. 👨‍💻

Essedrop - 이미지 주소를 만드는 가장 빠른 방법
 

독자 의견

저자 @richard 에게 의견 남기기:

Please sign in to comment.
Markdown is also available in comment.