使用Nginx搭建文件服务器

阅读更多
下载Nginx软件包
wget http://nginx.org/download/nginx-1.17.3.tar.gz

解压Nginx软件包
tar -zxvf nginx-1.17.3.tar.gz

切换到Nginx目录
cd nginx-1.17.3

安装Nginx依赖包
yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel gcc gcc-c++

安装Nginx到系统
./configure --with-http_dav_module
make
make install

修改Nginx的配置
cd /usr/local/nginx/conf
vi nginx.conf
============================================================
location / {
    root   html;
    client_body_temp_path html;
    dav_methods PUT;
    create_full_put_path on;
    dav_access user:rw group:r all:r;

    limit_except GET {
        auth_basic "closed site";
        auth_basic_user_file htpasswd;
    }
    index  index.html index.htm;
}
============================================================

写入密码到文件
echo 'bessky:52PrWRJdkBic6' > htpasswd

启动Nginx服务
../sbin/nginx

你可能感兴趣的:(nginx,webdav)