우분투 아파치 WebDAV 설정
2017.09.24 21:04
우분투 아파치 WebDAV 설정
1 개요[편집]
- 아파치 WebDAV 설정
- 아파치에 HTTP 기본 인증으로 사용하는 WebDAV를 설정해보자.
2 사전 작업[편집]
3 아파치 모듈 확인[편집]
root@zetawiki:~# apachectl -D DUMP_MODULES | grep dav
root@zetawiki:~#
4 dav_fs 모듈 활성화[편집]
root@zetawiki:~# a2enmod dav_fs
Considering dependency dav for dav_fs:
Enabling module dav.
Enabling module dav_fs.
To activate the new configuration, you need to run:
service apache2 restart
root@zetawiki:~# apachectl -D DUMP_MODULES | grep dav
dav_module (shared)
dav_fs_module (shared)
Syntax OK
5 패스워드 파일 생성[편집]
- 우분투 htpasswd 설치 문서를 참고하십시오.
root@zetawiki:~# htpasswd -c /etc/apache2/webdav.pwd testuser
New password: P@ssw0rd
Re-type new password: P@ssw0rd
Adding password for user testuser
6 webdav 폴더, 테스트 파일 생성[편집]
root@zetawiki:~# mkdir /var/www/webdav
root@zetawiki:~# echo hello > /var/www/webdav/greet.txt
root@zetawiki:~# chown -R www-data. /var/www/webdav/
root@zetawiki:~# ll /var/www/webdav/
total 12
drwxr-xr-x 2 www-data www-data 4096 Jun 21 17:22 ./
drwxr-xr-x 5 root root 4096 Jun 21 17:22 ../
-rw-r--r-- 1 www-data www-data 6 Jun 21 17:22 greet.txt
7 아파치 설정파일 수정, 재시작[편집]
- /etc/apache2/sites-enabled/000-default.conf 파일에서
<VirtualHost *:80></VirtualHost>
내부 하단에 내용 추가
root@zetawiki:~# vi /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
... (생략)
Alias /webdav /var/www/webdav
<Location /webdav>
DAV On
AuthType Basic
AuthName "== My First WebDAV =="
AuthUserFile /etc/apache2/webdav.pwd
Require valid-user
</Location>
<Directory /var/www/webdav>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
- 아파치 재시작
root@zetawiki:~# service apache2 restart
* Restarting web server apache2 [ OK ]
8 curl 테스트[편집]
- 헤더 확인
root@zetawiki:~# curl -I http://localhost/webdav
HTTP/1.1 401 Unauthorized
Date: Sun, 01 May 2016 07:51:47 GMT
Server: Apache/2.4.7 (Ubuntu)
WWW-Authenticate: Basic realm="== My First WebDAV =="
Content-Type: text/html; charset=iso-8859-1
- 업로드 테스트
root@zetawiki:~# echo world > greet2.txt
root@zetawiki:~# curl -u testuser:P@ssw0rd -T greet2.txt http://localhost/webdav/greet2.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>
root@zetawiki:~# ll /var/www/webdav/
total 16
drwxr-xr-x 2 www-data www-data 4096 Jun 21 17:33 ./
drwxr-xr-x 5 root root 4096 Jun 21 17:22 ../
-rw-r--r-- 1 www-data www-data 6 Jun 21 17:33 greet2.txt
-rw-r--r-- 1 www-data www-data 6 Jun 21 17:22 greet.txt
9 (Optional) cadaver 테스트[편집]
- 우분투 cadaver 설치
- 로컬호스트에 대해 테스트
root@zetawiki:~# cadaver http://localhost/webdav
Authentication required for == My First WebDAV == on server `localhost':
Username: testuser
Password: P@ssw0rd
dav:/webdav/> ls
Listing collection `/webdav/': succeeded.
greet.txt 6 Dec 14 15:11
dav:/webdav/> cat greet.txt
Displaying `/webdav/greet.txt':
hello
dav:/webdav/> quit
Connection to `localhost' closed.
root@zetawiki:~#
10 같이 보기[편집]
11 참고[편집]
- http://httpd.apache.org/docs/2.2/mod/mod_dav.html
- https://www.digitalocean.com/community/tutorials/how-to-configure-webdav-access-with-apache-on-ubuntu-12-04
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.