文件服务器配置

2020-04-14  本文已影响0人  游侠_6fb7

apache服务器已经集成了WebDAV模块,所以只需要启用该模块即可。

  1. 编辑 /etc/httpd/conf/httpd.conf
    $ vi /etc/httpd/conf/httpd.conf
    在文件的最后添加以下语句:
    Include conf/webdav.conf #指定webdav的配置文件路径
  2. 新建webdav配置文件
    $ vi /etc/httpd/conf/webdav.conf
    将以下内容插入到文件中:
    <IfModule mod_dav.c>
    LimitXMLRequestBody 131072
    Alias /webdav "/var/www/webdav"
    <Directory /var/www/webdav>
    Dav On
    Options +Indexes
    IndexOptions FancyIndexing
    AddDefaultCharset UTF-8
    AuthType Basic
    AuthName "WebDAV Server"
    AuthUserFile /etc/httpd/webdav.users.pwd
    Require valid-user
    Order allow,deny
    Allow from all
    </Directory>
    </IfModule>
  3. mkdir -p /var/www/webdav chown apache:apache /var/www/webdav
  4. 添加用户
    $ htpasswd -c /etc/httpd/webdav.users.pwd test #根据提示输入密码
  5. 重启apache服务
    $ service httpd restart

mac webdav服务
cd /etc/apache2
sudo vim httpd.conf // 查找httpd-dav.conf /httpd-dav.conf 通过搜索找到这几行 LoadModule dav_module libexec/apache2/mod_dav.so LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so 并且把他们行首的#号删除 (友情提示,他们这些行长的都很像一定要看清了别改错了) 按esc完成编辑,输入:wq退出 // 然后切换目录 cd /etc/apache2/extra
// 备份文件(切记只要备份一次就行)
sudo cp httpd-dav.conf httpd-dav.conf.bak // 现在要编辑这个文件了 sudo vim httpd-dav.conf
// 查找Digest 把编辑模式从Digest改成Basic 还是那几步,改完了之后保存退出
http://www.linuxidc.com/Linux/2015-02/113577.htm
https://www.cnblogs.com/QianChia/p/5824382.html

页面展示配置 参考配置文档 https://www.linuxidc.com/Linux/2017-01/139442.htm

展示不全,乱码配置

Further relax access to the default document root:

<Directory "/opt/xxx/download">

#

# Possible values for the Options directive are "None", "All",

# or any combination of:

#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

#

# Note that "MultiViews" must be named *explicitly* --- "Options All"

# doesn't give it to you.

#

# The Options directive is both complicated and important.  Please see

# http://httpd.apache.org/docs/2.4/mod/core.html#options

# for more information.

#

Options Indexes FollowSymLinks

#add by wangjun

indexOptions FancyIndexing ScanHTMLTitles NameWidth=* DescriptionWidth=* HTMLTable Charset=UTF-8 VersionSort FoldersFirst

#

# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

配置完成后重启apache服务

上一篇 下一篇

猜你喜欢

热点阅读