搭建自己的webdav
- 使用docker-compose安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| version: '3' services: webdav: image: bytemark/webdav container_name: webdav restart: always ports: - "81:80" environment: AUTH_TYPE: Digest USERNAME: username PASSWORD: xxxxxxx volumes: - /home/<username>/webdav/dav:/var/lib/dav
|
- 使用nginx反代
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| server { listen 80; server_name dav.xx.com; location / { proxy_pass http://127.0.0.1:81; proxy_set_header Host $host; proxy_set_header remote_addr $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; add_header Cache-Control no-cache; } if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot" ) { return 403; } access_log /www/wwwlogs/dav.xx.com.log; #日志可以不写 error_log /www/wwwlogs/dav.xx.com.error.log; }
|
应用里显示正常,网页现在显示的是乱码,看着很不舒服
需要修改‘httpd.conf’的配置,首先需要将文件挂载到本地,要不然重启容器后会消失
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| docker exec -it webdav bash su root cp /usr/local/apache2/conf/httpd.conf /var/lib/dav/ exit exit mv /home/<username>/webdav/dav/httpd.conf /home/<username>/webdav/apache2_conf/httpd.conf
vim httpd.conf
AddDefaultCharset utf-8 IndexOptions +Charset=UTF-8 AddCharset UTF-8 .utf8
docker-compose down && docker-compose up -d
|
刷新网页就变成正常字体了