apt-get install lighttpd lighttpd-mod-webdav apache2-utils
#install lighttpd and additional module lighttpd-mod-webdav
#apache2-utils:htpasswd to generate webdav password file, lighttpd also reuse it
chown www-data:www-data /var/run/lighttpd/
#access to www-data user and group
lighty-enable-mod auth
lighty-enable-mod webdav
#enable authorization
htpasswd -c /var/www/passwd.dav testuser
#prompt to input password
chown root:www-data /var/www/passwd.dav
chmod 640 /var/www/passwd.dav
#create users
mkdir -p /var/www/dav
chown www-data:www-data /var/www/dav
#create directory to be shared by webdav
vi /etc/lighttpd/lighttpd.conf
#reroute webdav
#server.modules = (
# "mod_access",
# "mod_webdav",#+
# #...
# $HTTP["host"] == "www.example.com" {
# server.document-root = "/var/www/web"
# alias.url = ( "/webdav" => "/var/www/dav" )
# $HTTP["url"] =~ "^/webdav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "disable"
# webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
# auth.backend = "htpasswd"
# auth.backend.htpasswd.userfile = "/var/www/passwd.dav"
# auth.require = ( "" => ( "method" => "basic",
# "realm" => "webdav",
# "require" => "valid-user" ) )
# }
# }
/etc/init.d/lighttpd restart
#take effect
apt-get install lighttpd lighttpd-mod-webdav apache2-utils
#install lighttpd and additional module lighttpd-mod-webdav
#apache2-utils:htpasswd to generate webdav password file, lighttpd also reuse it
chown www-data:www-data /var/run/lighttpd/
#access to www-data user and group
lighty-enable-mod auth
lighty-enable-mod webdav
#enable authorization
htpasswd -c /var/www/passwd.dav testuser
#prompt to input password
chown root:www-data /var/www/passwd.dav
chmod 640 /var/www/passwd.dav
#create users
mkdir -p /var/www/dav
chown www-data:www-data /var/www/dav
#create directory to be shared by webdav
vi /etc/lighttpd/lighttpd.conf
#reroute webdav
#server.modules = (
# "mod_access",
# "mod_webdav",#+
# #...
# $HTTP["host"] == "www.example.com" {
# server.document-root = "/var/www/web"
# alias.url = ( "/webdav" => "/var/www/dav" )
# $HTTP["url"] =~ "^/webdav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "disable"
# webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
# auth.backend = "htpasswd"
# auth.backend.htpasswd.userfile = "/var/www/passwd.dav"
# auth.require = ( "" => ( "method" => "basic",
# "realm" => "webdav",
# "require" => "valid-user" ) )
# }
# }
/etc/init.d/lighttpd restart
#take effect
apt-get install lighttpd lighttpd-mod-webdav apache2-utils #install lighttpd and additional module lighttpd-mod-webdav #apache2-utils:htpasswd to generate webdav password file, lighttpd also reuse it chown www-data:www-data /var/run/lighttpd/ #access to www-data user and group lighty-enable-mod auth lighty-enable-mod webdav #enable authorization htpasswd -c /var/www/passwd.dav testuser #prompt to input password chown root:www-data /var/www/passwd.dav chmod 640 /var/www/passwd.dav #create users mkdir -p /var/www/dav chown www-data:www-data /var/www/dav #create directory to be shared by webdav vi /etc/lighttpd/lighttpd.conf #reroute webdav #server.modules = ( # "mod_access", # "mod_webdav",#+ # #... # $HTTP["host"] == "www.example.com" { # server.document-root = "/var/www/web" # alias.url = ( "/webdav" => "/var/www/dav" ) # $HTTP["url"] =~ "^/webdav($|/)" { # webdav.activate = "enable" # webdav.is-readonly = "disable" # webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db" # auth.backend = "htpasswd" # auth.backend.htpasswd.userfile = "/var/www/passwd.dav" # auth.require = ( "" => ( "method" => "basic", # "realm" => "webdav", # "require" => "valid-user" ) ) # } # } /etc/init.d/lighttpd restart #take effect
转自:https://gist.github.com/huazhihao/3753705