Install webdav service in linux environment

Install webdav service on CentOS

After stepping on the pit for an afternoon, I will record it here.
I opened the webdav service mainly for the document synchronization of zotero, and I need to share documents.

Let's get to the point:

Install apache webdav service

yum install httpd* -y

Installed in /etc/httpdthe directory of the machine

Change setting

vi /etc/httpd/conf/httpd.conf

#在里面最后添加如下内容
<IfModule mod_dav.c>
        LimitXMLRequestBody 131072
        Alias /webdav "/home/webdav"
        <Directory /home/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>

#其中 /home/webdav 要替换为自己的目录(配置文件中有两处)

modify user permissions

There are two ways

use default user

The default user name is apache
directly enter the following command to modify the password and transfer the directory authority mapped by webdav to apache

htpasswd -c /etc/httpd/webdav.users.pwd apache
#输入新密码

chown apache:apache /home/webdav/ 

Use your own newly created user

Create a xiaoming account

htpasswd -c /etc/httpd/passwd.dav xiaoming
#输入密码
chown xiaoming /home/webdav/ 

restart service

systemctl restart httpd.service
#或者
service httpd.service restart

Then you can access it.
If you don’t have a domain name, you can access it through ip eg: enter http://219.220.220.13:80/webdav
in the browser .

Notice

  1. here is http not https
  2. is /webdav not //home/webdav/
  3. If the access returns 405, it may be that the cloud server has not opened the firewall of this port, remember to open it
  4. /etc/httpd/conf/httpd.confThe default listening port of this file is 80, you can modify the port to 8081, 8091, etc., but remember to modify the access port in ip synchronously

Guess you like

Origin blog.csdn.net/Fucking_Code0916/article/details/130546663