【问题标题】:Raspberry Pi Apache2 not accessing the user files using HTMLRaspberry Pi Apache2 未使用 HTML 访问用户文件
【发布时间】:2018-12-19 05:42:20
【问题描述】:

我正在尝试为安装了 apache2 服务器的 Raspberry pi 编写 HTML 网页。当我使用下面的代码时,图像和下载文件似乎没有显示在网页上。请有人告诉我是什么问题。

<i>
<body>


<header>
     <img src="/home/admins/LOGO.png" alt="LOGO" width="450" height="100">

</header>
        <hr>
</nav>

  <article>
    <h1>Result Download</h1>
        <p> <br /> <br /><br/> </p>
        <a href="/home/admins/Data.txt" download="DataFile" >
                <img align = "centre" border="0" src="/home/admins/Download.png" alt="Download" width="120" height="150">
        </a>
  </article>
</section>

<footer>
  <p>©Copyright 2018</p>
</footer>

</body>

</i>

【问题讨论】:

    标签: html linux apache raspberry-pi3


    【解决方案1】:

    安装了 apache2 服务器

    所以你大概是通过 HTTP 加载文件。

    /home/admins/LOGO.png

    ...但是这个 URL 似乎是本地文件系统上的文件路径。


    Apache的默认配置不把文件系统的根(/)当作网站的根。

    这将是一个严重的安全问题,因为它会暴露计算机上的每个文件(包括密码文件)!

    相反,它希望文件位于为网站保留的目录中。这通常是/var/www/,但使用the DocumentRoot directive 进行配置。

    如果您想通过 HTTP 公开文件,请将其移动到 DocumentRoot 内或配置 an Alias 以将 URL 映射到文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-06
      • 2022-08-30
      • 2015-07-15
      相关资源
      最近更新 更多