RadarURL
Skip to content
조회 수 2874 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

nginx에 apache 에서 쓰던 방법으로 htaccess 를  적용하니 안되는것 같다.

이래저래 시도해보다 성공해서 기록용으로 남긴다.

nginx.conf 파일을 보면 기본적으로

root 경로;

location 하위경로 {
}

식의 구성이다.

(만약 location 부분이 없다면 새로 추가하면 된다.)


예를들면 myweb.com/test 경로의 접근을 막고 싶다면

root /home/myweb/www;

location /test {
            auth_basic "RESTRICTED ACCESS";
            auth_basic_user_file /home/myweb/www/test/.htpasswd;
}

처럼 설정을 저장한다. 따옴표안의 문구는 맘대로 바꿔도 된다. 사용자 계정을 물어보는 창에 나오는 문구다.

위와 같이 설정을 하고 .htpasswd 파일을 만든다.
위치는 당연히 auth_basic_user_file 에 지정한 곳이다.

해당 디렉토리로 들어가서
htpasswd -c .htpasswd 아이디
를 치면 password 를 물어본다. 입력하면 된다.

만들 아이디가 admin 이라면
htpasswd -c .htpasswd admin

htpasswd 도움말을 보면 아이디 추가와 암호변경도 가능하니 도움말을 참고한다.

마지막으로 nginx 를 재시작하면 적용된걸 확인 할수 있다.

1111.jpg


test/a test/b 같은 하위디렉토리에도 적용된다.

 

출처 : http://kyrandia.tistory.com/581

?

  1. No Image 11Apr
    by JaeSoo
    2014/04/11 by JaeSoo
    Views 2010 

    NGXMP 16.0 버전에서 Log에 upstream timed out (10060: 연결된 구성원으로부터 응답이 없어 연결하지 못했거나, 호스트로부터 응답이 없어 연결이 끊어졌습니다) while connecting to upstream, upstream: "fastcgi://127.0.0.1:9000"

  2. No Image 09Apr
    by JaeSoo
    2014/04/09 by JaeSoo
    Views 1729 

    504 Gateway Time-out using Nginx

  3. No Image 09Apr
    by JaeSoo
    2014/04/09 by JaeSoo
    Views 2220 

    Nginx, FastCGI 지시어 및 설명 (504 Gateway Time-out 관련 설정 등)

  4. No Image 08Apr
    by JaeSoo
    2014/04/08 by JaeSoo
    Views 1497 

    Nginx Log에서 upstream timed out (110: Connection timed out) while reading response header from upstream

  5. No Image 08Apr
    by JaeSoo
    2014/04/08 by JaeSoo
    Views 1540 

    nginx 504 gateway time-out

  6. No Image 07Apr
    by JaeSoo
    2014/04/07 by JaeSoo
    Views 1610 

    Nginx SERverSETting

  7. No Image 10Jun
    by JAESOO
    2013/06/10 by JAESOO
    Views 2902 

    Nginx에서 php 외에 추가로 여러 확장자를 처리 방법

  8. No Image 10Jun
    by JAESOO
    2013/06/10 by JAESOO
    Views 1694 

    Nginx 설치 (간략)

  9. Apache vs Nginx 성능을 밝혀라!

  10. 아파치 2.4는 러시안 강호 NGINX를 넘을 수 있는가?

  11. No Image 12Apr
    by JaeSoo
    2013/04/12 by JaeSoo
    Views 3211 

    nginx 재시작 배치파일

  12. NGINX서버를 통한 다운로드 링크 형성하기(POGOPLUG SERIES 4용)

  13. nginx 에서 htaccess 사용하기

  14. No Image 08Apr
    by JaeSoo
    2013/04/08 by JaeSoo
    Views 2794 

    Nginx HttpRewriteModule

  15. No Image 08Apr
    by JaeSoo
    2013/04/08 by JaeSoo
    Views 8866 

    Nginx 와 Apache 동시사용 설정 (영문)

  16. Xpress engine nginx rewrite 설정, 짧은주소 (xpressengine)

  17. NGINX 소개와 사용 현황

  18. No Image 20Nov
    by JaeSoo
    2012/11/20 by JaeSoo
    Views 5069 

    강력한 웹서버 NGINX

  19. Nginx 웹서버 성능분석

  20. 제로보드XE(Xpressengine) Anti-accessXE:기본설정

Board Pagination Prev 1 2 Next
/ 2

PageViews   Today : 1622 Yesterday : 2394 Total : 21715280  /  Counter Status   Today : 308 Yesterday : 1232 Total : 1142450

Edited by JAESOO

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소