标签 nginx 下的文章

Nginx搭建WebDAV服务器

搭建webDAV服务前,先确认已安装nginx

配置webdav.conf

创建用于webdav的nginx配置文件:

vim /etc/nginx/conf.d/webdav.conf

设置内容:

server {
    listen 80;
    listen [::]:80;

    server_name webdav.youdomain.com;

    # 认证方式
    auth_basic              realm_name;
    # 存放认证用户名、密码文件(确认有对应权限)
    auth_basic_user_file    /data/www/webdav/.credentials.list;
    root /data/www/webdav/;

    # dav allowed method
    dav_methods     PUT DELETE MKCOL COPY MOVE;
    # Allow current scope perform specified DAV method
    dav_ext_methods PROPFIND OPTIONS;

    # In this folder, newly created folder or file is to have specified permission. If none is given, default is user:rw. If all or group permission is specified, user could be skipped
    dav_access      user:rw group:rw all:r;

    # MAX size of uploaded file, 0 mean unlimited
    client_max_body_size    0;

    # Allow autocreate folder here if necessary
    create_full_put_path    on;
}

创建用户

用户名

echo -n '$yourname:' | tee -a /data/www/webdav/.credentials.list

设置密码

openssl passwd -apr1 | tee -a /data/www/webdav/.credentials.list

重新加载nginx

# 检验配置文件
nginx -t

# 重启nginx
nginx -s reload

参考文章

Linux Nginx 1.15.5源码编译安装

说明:

  • 安装nginx版本为1.15.5,其他版本类似
  • nginx解压后工作空间目录:/data/workspace/nginx
  • nginx安装目录:/data/soft/nginx
  • nginx依赖opensslpcrezlib,这些包可以下载解压,但不用安装

1、下载并解压nginx、openssl、pcre、zlib源码

# nginx (https://nginx.org/download/)
wget https://nginx.org/download/nginx-1.15.5.tar.gz
# openssl
wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz
# pcre
wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
# zilb
wget https://zlib.net/zlib-1.2.11.tar.gz
# 解压
tar zxf nginx-1.15.5.tar.gz -C /data/workspace
tar zxf openssl-1.1.0i.tar.gz -C /data/workspace
tar zxf pcre-8.42.tar.gz -C /data/workspace
tar zxf zlib-1.2.11.tar.gz -C /data/workspace
# 将nginx目录改名
mv nginx-1.15.5 nginx
cd nginx

2、安装所需依赖和工具

apt-get install make gcc g++ perl libperl-dev

- 阅读剩余部分 -