OS/Linux

mac os에서 nginx를 이용한 webdav구축

xzpluszone 2020. 9. 9. 09:36
 
 

2020.09 버전

brew 레파지토리 추가.

brew tap denji/nginx
# https://github.com/denji/homebrew-nginx

brew로 nginx-full 설치

nginx도 같이 설치됨.
brew install nginx-full --with-debug --with-gunzip ---with-http2 --with-passenger --with-webdav --with-dav-ext-module

nginx 설정

webdav 접근유저 설정
/usr/local/etc/nginx/ 패스는 저장될 패스워드 파일을 원하는 곳으로.. 설정
htpasswd -c /usr/local/etc/nginx/user.passwd admin
#admin 계정 설정
htpasswd /usr/local/etc/nginx/user.passwd xxxx
#xxxx 기타 계정 설정

nginx configure 설정파일

root /...../share 공유할 위치를 절대경로 설정.
/usr/local/etc/nginx 패스는 앞서 설정한 위치랑 맞아야함.
vi /usr/local/etc/nginx/nginx.conf
{
....

# WebDAV 추가한다.
server {
listen 9876;
error_page 404 /404;
error_page 503 /503;

# 공유 폴더 설정
location / {
root /...../share;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
create_full_put_path on;
dav_access user:rw group:rw all:r;

auth_basic "Authorized Users Only";
auth_basic_user_file /usr/local/etc/nginx/user.passwd;
}

#무시해도 되는 파일 설정
location ~ \.(_.*|DS_Store|Spotlight-V100|TemporaryItems|Trashes|hidden)$ {
access_log off;
error_log off;

if ($request_method = PUT) {
return 403;
}
return 404;
}

location ~ \.metadata_never_index$ {
return 200 "Don't index this drive, Finder!";
}
}

....
}

nginx 서비스 시작

nginx 시작확인
ps aux | grep nginx
user 18937 0.0 0.0 4968984 1800 ?? S 2:26PM 0:00.01 nginx: worker process
user 18936 0.0 0.0 4435480 564 ?? Ss 2:26PM 0:00.00 nginx: master process nginx

webdav 접속테스트

cadaver 접속툴 설치
brew install cadaver
==> Downloading https://homebrew.bintray.com/bottles/neon-0.31.2.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/cadaver-0.23.3_5.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for cadaver: neon
==> Installing cadaver dependency: neon
==> Pouring neon-0.31.2.catalina.bottle.tar.gz
/usr/local/Cellar/neon/0.31.2: 179 files, 717.9KB
==> Installing cadaver
==> Pouring cadaver-0.23.3_5.catalina.bottle.tar.gz
/usr/local/Cellar/cadaver/0.23.3_5: 12 files, 280.9KB
접속테스트 명령어
➜ Formula git:(master) cadaver http://127.0.0.1:9876
Authentication required for Authorized Users Only on server `127.0.0.1':
Username: user
Password:
dav:/>
dav:/>
dav:/> ls
Listing collection `/': succeeded.
Coll: share 0 9 1 21:05

dav:/> exit
Connection to `127.0.0.1' closed.

 

'OS > Linux' 카테고리의 다른 글

ReadElf Version info 보기  (0) 2016.01.13