블로그 이미지
훅크선장

카테고리

분류 전체보기 (361)
사진이야기 (23)
펭귄컴퓨팅 (120)
컴퓨터보안 (84)
절름발이 프로그래머 (59)
하드웨어개조 (23)
멀알려줄까 (35)
홈베이킹&홈쿠킹 (2)
잡다한것들 (15)
Total
Today
Yesterday

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

공지사항

태그목록

최근에 올라온 글

아래 링크 내용을 참고하였음.
http://www.cyberciti.biz/tips/lighttpd-setup-a-password-protected-directory-directories.html


1. lighttpd-mod-auth 모듈을 설치한다.

root@HomeRouter:/etc/lighttpd# opkg install lighttpd-mod-auth
Installing lighttpd-mod-auth (1.4.29-3) to root...
Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/lighttpd-mod-auth_1.4.29-3_ar71xx.ipk.
Configuring lighttpd-mod-auth.

2. lighttpd.conf 설정파일에서 인증과 관련된 내용을 추가한다.
mod_auth 모듈의 사용 여부를 지정하고, 인증 방식과 인증 관련 파일 지정 및 인증 디렉토리별 사용자 설정을 한다.

root@HomeRouter:/etc/lighttpd# vi lighttpd.conf 
# lighttpd configuration file
...
<중략>
...
server.modules = ( 
# "mod_rewrite", 
# "mod_redirect", 
# "mod_alias", 
"mod_auth", 
# "mod_status", 
# "mod_setenv",
# "mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_cgi",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_webdav"
)

...
<중략>
...

#### auth module
## read authentification.txt for more info
auth.debug = 2
auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
auth.backend.plain.userfile = "/etc/lighttpd/.lighttpdpassword"
#auth.backend.plain.groupfile = "lighttpd.group"
auth.require = (
# "/server-status" => ( 
# "method"  => "digest",
# "realm"   => "download archiv",
# "require" => "group=www|user=jan|host=192.168.2.10"
# ),
"/download/" => ( 
"method"  => "basic",
"realm"   => "Private Download Area",
"require" => "user=webuser"
)
)

3. 인증용 패스워드 파일을 생성하고, 사용자명과 패스워드를 적어준다.

root@HomeRouter:/etc/lighttpd# ll
drwxr-xr-x    2 root     root          4096 Jan  4 09:36 .
drwxr-xr-x   17 root     root          4096 Dec 30 00:03 ..
-rw-r--r--    1 root     root            14 Jan  4 09:36 .lighttpdpassword
-rw-r--r--    1 root     root          6077 Jan  4 09:51 lighttpd.conf
root@HomeRouter:/etc/lighttpd# vi .lighttpdpassword 
webuser:password
~

4. lighttpd 데몬을 재시작한다.
 
root@HomeRouter:/etc/lighttpd# sync
root@HomeRouter:/etc/lighttpd# /etc/init.d/lighttpd restart

5. 정상적인 동작이 되지 않을 때는, 디버깅한다.

lighttpd.conf 파일에 다음 내용을 추가하고, 데몬을 재시작한다.
 ## where to send error-messages to
server.errorlog = "/var/log/lighttpd/error.log"

지정된  /var/log/lighttpd/error.log 파일 내용을 보면, 어떤 문제가 생겼는지를 알 수가 있다.
 
Posted by 훅크선장
, |