[英]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. 我正在尝试为安装了apache2服务器的Raspberry pi编写HTML网页。 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
已安装apache2服务器
So you are, presumably loading the files over HTTP. 因此,大概是通过HTTP加载文件。
/home/admins/LOGO.png
/home/admins/LOGO.png
… but this URL seems to be a file path on the local file system. …但是此URL似乎是本地文件系统上的文件路径。
The default configuration of Apache does not treat the root of the file system ( /
) as the root of the website. Apache的默认配置不将文件系统(
/
)的根视为网站的根。
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 . 这通常是
/var/www/
但使用DocumentRoot
指令进行配置。
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. 如果要通过HTTP公开文件,则将其移至DocumentRoot内,或配置
Alias
以将URL映射到文件上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.