简体   繁体   中英

Raspberry Pi Apache2 not accessing the user files using HTML

I am trying to write a HTML web page for my Raspberry pi, which is having apache2 server installed. When I have used the below code looks like the images and download files are not displaying on the web page. Please somebody tell me what is the problem.

<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>

which is having apache2 server installed

So you are, presumably loading the files over HTTP.

/home/admins/LOGO.png

… but this URL seems to be a file path on the local file system.


The default configuration of Apache does not treat the root of the file system ( / ) as the root of the website.

This would be a massive security problem as it would expose every file (including the password files) on the computer!

Instead it expects files to be in a directory put aside for the website. This is often /var/www/ but is configured using the DocumentRoot directive .

If you want to expose a file over HTTP, then move it inside the DocumentRoot or configure an Alias to map a URL onto the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM