首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >WebDav -浏览器上的禁忌

WebDav -浏览器上的禁忌
EN

Ask Ubuntu用户
提问于 2021-04-04 12:29:43
回答 1查看 551关注 0票数 0

我正在尝试使用raspberry pi创建一个服务器,但在此之前,我决定先在虚拟机中测试它。因此,我在/var/www/中创建了webdav和webdav2两个文件夹,它们工作得很好(Chrome和nautilus显示了它们的内容,我还可以向其中添加文件)。但是,当我试图在/mnt/webdav_share中创建服务器时,我没有获得同样的成功。我可以在Nautilus上访问它,但在Chrome中,我得到了“禁止”--您没有访问该资源的权限。

这是我的配置文件:

代码语言:javascript
运行
复制
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
    Alias /webdav /var/www/webdav
    
    DAV On
    AuthType Basic
    AuthName "webdav"
    AuthUserFile /var/www/webdav/passwd.dav
    Require valid-user
    

    Alias /webdav2 /var/www/webdav2
    
    DAV On
    AuthType Basic
    AuthName "webdav2"
    AuthUserFile /var/www/webdav2/.secrets/passwd.dav
    Require valid-user
    

    Alias /webdav_share /mnt/webdav_share
    
    DAV On
    AuthType Basic
    AuthName "webdav_share"
    AuthUserFile /mnt/webdav_share/.secrets/passwd.dav
    Require valid-user
    AllowOverride all
    Order allow,deny
    allow from all
    

    

    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

文件属性

代码语言:javascript
运行
复制
    drwxr-xr-x  5 www-data www-data 4.0K Apr  4 21:50 webdav_share
    drwxrwxr-x 2 www-data www-data 4.0K Apr  4 20:11  .secrets
    -rw-r--r-- 1 www-data www-data   44 Apr  4 20:32 passwd.dav

谢谢,

爱德华多

EN

回答 1

Ask Ubuntu用户

发布于 2021-04-08 22:53:55

所以,答案是:

默认情况下,Ubuntu不允许通过web浏览器访问/var/www、public_html目录(启用时)和/usr/share (用于web应用程序)中的任何文件。如果您的站点正在使用位于其他地方(如/srv)的web文档根目录,则可能需要在/etc/apache2/apache2.conf中白名单您的文档根目录。默认的Ubuntu文档根目录是/var/www/html。您可以在/var/www下创建自己的虚拟主机。这与以前的版本不同,后者提供了更好的开箱即用的安全性。

刚把我的文件夹添加到文件中,它就开始工作了。

谢谢

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1329165

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档