最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

linux 环境安装 webdav 服务

互联网 admin 0浏览 0评论

linux 环境安装 webdav 服务

linux 环境安装 webdav 服务

执行安装语句

yum install httpd* -y

安装路径为:/ect/httpd/

相关配置

httpd.conf

在文件 /etc/httpd/conf/httpd.conf 内添加以下内容

Include conf/webdav.conf

作用是引入webdav的相关配置

修改监听的端口号

也就是修改 webdav 访问的端口号

cd /etc/httpd/conf/
vim httpd.conf
# 进入编辑模式,找到Listen
Listen 9080
# 修改需要监听的端口,即可退出 :wq
创建 webdav.conf

/etc/httpd/conf/ 目录下创建 webdav.conf 文件(注:创建配置文件的路径要跟配置在httpd.conf上的一致)

cd /etc/httpd/conf/
vim webdav.conf
# 进入vim编辑后,输入以下内容
# 其中 "/home/webdav",要配置成自己的路径
<IfModule mod_dav.c>LimitXMLRequestBody 131072Alias /webdav "/home/webdav"<Directory /home/webdav>Dav OnOptions +IndexesIndexOptions FancyIndexingAddDefaultCharset UTF-8AuthType BasicAuthName "WebDAV Server"AuthUserFile /etc/httpd/webdav.users.pwdRequire valid-userOrder allow,denyAllow from all</Directory>
</IfModule># 退出编辑模式,执行 :wq

注意:复制这段到webdav.conf 的时候注意下文章尾部碰到的问题

配置用户权限
  • 创建目录
    该目录要和配置在 webdav.conf 上的对应

    mkdir /home/webdav/
    
  • 设置用户
    apache 这个用户好像在安装httpd后就有了,我这边是直接可以配置了,在 httpd.conf 中也可以看到配置了:

User apache
Group apache
# 指定文件的拥有者:用户组
chown apache:apache /home/webdav/ 
  • 配置用户密码
# apache 为用户名,回车后即可输入密码
htpasswd -c /etc/httpd/webdav.users.pwd apache

启动服务

systemctl restart httpd.service
# 或者
service httpd.service restart# 查看服务状态
systemctl status httpd.service

碰到的错误

  • 因为 webdav.conf 配置内容导致错误

    直接复制网上的内容进去,导致启动失败,执行 systemctl status httpd.service 发现以下信息:

    Invalid command '\xc2\xa0\xc2\xa0\xc2\xa0', perhaps misspelled or defined by a module not inc...guration
    

    解决办法:将网页上的内容复制到本地文档后再复制进去,就解决了。个人是认为可能存在一些特殊的字符,导致读取配置时失败。我尝试过去转 ‘\xc2\xa0\xc2\xa0\xc2\xa0’ 但是没有成功,希望有了解的人可以帮忙解答下。

详细的错误信息
# 执行 restart 命令后出现的错误信息
systemctl restart httpd.service 
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpls".
# 查看详细的错误信息
systemctl status httpd.service● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: failed (Result: exit-code) since Tue 2020-06-02 22:56:05 CST; 14s agoDocs: man:httpd(8)man:apachectl(8)Process: 23889 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)Process: 23887 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)Main PID: 23887 (code=exited, status=1/FAILURE)Jun 02 22:56:05 VM_0_2_centos systemd[1]: Starting The Apache HTTP Server...
Jun 02 22:56:05 VM_0_2_centos httpd[23887]: AH00526: Syntax error on line 2 of /etc/httpd/conf/webdav.conf:
Jun 02 22:56:05 VM_0_2_centos httpd[23887]: Invalid command '\xc2\xa0\xc2\xa0\xc2\xa0', perhaps misspelled 
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 02 22:56:05 VM_0_2_centos kill[23889]: kill: cannot find process ""
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 02 22:56:05 VM_0_2_centos systemd[1]: Failed to start The Apache HTTP Server.
Jun 02 22:56:05 VM_0_2_centos systemd[1]: Unit httpd.service entered failed state.
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

参考文章:
Linux下搭建Webdav(apache)

linux 环境安装 webdav 服务

linux 环境安装 webdav 服务

执行安装语句

yum install httpd* -y

安装路径为:/ect/httpd/

相关配置

httpd.conf

在文件 /etc/httpd/conf/httpd.conf 内添加以下内容

Include conf/webdav.conf

作用是引入webdav的相关配置

修改监听的端口号

也就是修改 webdav 访问的端口号

cd /etc/httpd/conf/
vim httpd.conf
# 进入编辑模式,找到Listen
Listen 9080
# 修改需要监听的端口,即可退出 :wq
创建 webdav.conf

/etc/httpd/conf/ 目录下创建 webdav.conf 文件(注:创建配置文件的路径要跟配置在httpd.conf上的一致)

cd /etc/httpd/conf/
vim webdav.conf
# 进入vim编辑后,输入以下内容
# 其中 "/home/webdav",要配置成自己的路径
<IfModule mod_dav.c>LimitXMLRequestBody 131072Alias /webdav "/home/webdav"<Directory /home/webdav>Dav OnOptions +IndexesIndexOptions FancyIndexingAddDefaultCharset UTF-8AuthType BasicAuthName "WebDAV Server"AuthUserFile /etc/httpd/webdav.users.pwdRequire valid-userOrder allow,denyAllow from all</Directory>
</IfModule># 退出编辑模式,执行 :wq

注意:复制这段到webdav.conf 的时候注意下文章尾部碰到的问题

配置用户权限
  • 创建目录
    该目录要和配置在 webdav.conf 上的对应

    mkdir /home/webdav/
    
  • 设置用户
    apache 这个用户好像在安装httpd后就有了,我这边是直接可以配置了,在 httpd.conf 中也可以看到配置了:

User apache
Group apache
# 指定文件的拥有者:用户组
chown apache:apache /home/webdav/ 
  • 配置用户密码
# apache 为用户名,回车后即可输入密码
htpasswd -c /etc/httpd/webdav.users.pwd apache

启动服务

systemctl restart httpd.service
# 或者
service httpd.service restart# 查看服务状态
systemctl status httpd.service

碰到的错误

  • 因为 webdav.conf 配置内容导致错误

    直接复制网上的内容进去,导致启动失败,执行 systemctl status httpd.service 发现以下信息:

    Invalid command '\xc2\xa0\xc2\xa0\xc2\xa0', perhaps misspelled or defined by a module not inc...guration
    

    解决办法:将网页上的内容复制到本地文档后再复制进去,就解决了。个人是认为可能存在一些特殊的字符,导致读取配置时失败。我尝试过去转 ‘\xc2\xa0\xc2\xa0\xc2\xa0’ 但是没有成功,希望有了解的人可以帮忙解答下。

详细的错误信息
# 执行 restart 命令后出现的错误信息
systemctl restart httpd.service 
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpls".
# 查看详细的错误信息
systemctl status httpd.service● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: failed (Result: exit-code) since Tue 2020-06-02 22:56:05 CST; 14s agoDocs: man:httpd(8)man:apachectl(8)Process: 23889 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)Process: 23887 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)Main PID: 23887 (code=exited, status=1/FAILURE)Jun 02 22:56:05 VM_0_2_centos systemd[1]: Starting The Apache HTTP Server...
Jun 02 22:56:05 VM_0_2_centos httpd[23887]: AH00526: Syntax error on line 2 of /etc/httpd/conf/webdav.conf:
Jun 02 22:56:05 VM_0_2_centos httpd[23887]: Invalid command '\xc2\xa0\xc2\xa0\xc2\xa0', perhaps misspelled 
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 02 22:56:05 VM_0_2_centos kill[23889]: kill: cannot find process ""
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 02 22:56:05 VM_0_2_centos systemd[1]: Failed to start The Apache HTTP Server.
Jun 02 22:56:05 VM_0_2_centos systemd[1]: Unit httpd.service entered failed state.
Jun 02 22:56:05 VM_0_2_centos systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

参考文章:
Linux下搭建Webdav(apache)

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论