Giter Site home page Giter Site logo

full-webdav-nginx-docker's Introduction

Full-WebDAV-Nginx-Docker

一、有什么用?请参阅nginx-dav-ext-module

就是从nginx官方的dockerfile里加入了上面github链接的nginx-dav-ext-module,从而实现完整的webdav。

基于alpine3.10 nginx1.17.5 Image大小17.2MB

nginx.conf里默认加载了webdav模块,即load_module modules/ngx_http_dav_ext_module.so;

你可以使用dockerfile自己编译,也可以docker hub直接拉取我的Image

docker pull vizshrc/nginx

详情:my docker hub

二、使用方式:

1.创建nginx配置文件

vi /etc/nginx/conf.d/davhttps.conf

写入示例文件:

server {
    listen  443 ssl;
#ssl on;
ssl_certificate       /root/.acme.sh/feeling.com_ecc/feeling.com.cer;
ssl_certificate_key   /root/.acme.sh/feeling.com_ecc/feeling.com.key;
ssl_protocols         TLSv1 TLSv1.1 TLSv1.2 ;
ssl_ciphers           HIGH:!aNULL:!MD5;
server_name           dl.feeleg.com;

error_log /var/log/nginx/webdav.error.log error;
access_log  /var/log/nginx/webdav.access.log combined;
location / {
    root /root/;
    #root /root/VpsDownload/;
    charset utf-8;
    autoindex on;
    dav_methods PUT DELETE MKCOL COPY MOVE;
    dav_ext_methods PROPFIND OPTIONS;
    create_full_put_path  on;
    dav_access user:rw group:r all:r;
    auth_basic "Authorized Users Only";
    auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
    client_max_body_size 100m;
    }
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
    }
}

2.创建用户,最好把.htpasswd放在/etc/nginx/conf.d下面,所以命令是

htpasswd -c /etc/nginx/conf.d/.htpasswd username

如果提示找不到命令。需要先安装htpasswd命令,debian和ubuntu使用

apt-get install apache2-utils

3.创建并启动docker

至少需要挂载/etc/nginx/conf.d
同时container中包含nginx.conf已经加载webdav模块,所以不建议挂载整个/etc/nginx, 这会覆盖container中的/etc/nginx,这样会宿主机目录没有这个模块或nginx.conf没有写加载模块而失败,如果分开挂载则麻烦

docker run --name nginx -p 443:443 -v /etc/nginx/conf.d:/etc/nginx/conf.d:ro -v /root:/root/:ro -d vizshrc/nginx 到这里正常来说就成功了,可以去访问试试

4.我个人需要的挂载的命令调整如下:

docker run --name nginx -p 443:443 -v /etc/nginx/conf.d:/etc/nginx/conf.d:ro -v /var/www:/var/www:ro -v /root:/root/:ro --net v2-net -d vizshrc/nginx index.html

full-webdav-nginx-docker's People

Contributors

vizshrc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

full-webdav-nginx-docker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.