웹서버 nginx 폴더에 패스워드 설정
웹서비스 경로에 인증(사용자 아이디, 비밀번호) 걸기
nginx directory password auth setting
* apache htpasswd 유틸 필요
- htpasswd 유틸은 apache httpd 서버 프로그램에 포함되어 있음
- 리눅스는 기본 설치 되어 있음
- 윈도우용 httpd 프로그램 설치 파일 다운로드
https://www.apachehaus.com/cgi-bin/download.plx
//------------------
* 패스워드 추가
htpasswd -c c:\nginx\.htpasswd admin
htpasswd c:\nginx\.htpasswd user1
//------------------------
* nginx/conf/nginx.conf 수정
location /admin {
auth_basic "Admin page";
auth_basic_user_file c:\\nginx\\.htpasswd;
index index.php index.htm;
#php파일에도 보안 적용
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}