我正试图在我的本地网络上创建我自己的小网站。除了图像,一切都很好。因为一些奇怪的原因,我的网站不能加载任何图片。
HTML的根文件夹是/var/www/html。
/var/www/html/test.html:
<html>
<head>
<title>test</title>
</head>
<body>
<img src="sniky.png">
</body>
</html>ls -l /var/www/html:
-rwxrwxrwx 1 root root 2155 Jun 18 08:57 bp.html
-rwxrwxrwx 1 root root 2296 Jun 17 23:12 filmy.html
-rwxrwxrwx 1 root root 1776 Jun 17 23:03 index.html
-rwxrwxrwx 1 root root 1886 Jun 17 23:11 info.html
-rwxrwxrwx 1 root root 1 Jun 17 22:18 serialy.html
-rwxrwxrwx 1 root root 897669 Jun 18 08:54 sniky.jpg
-rwxrwxrwx 1 root root 93 Jun 18 08:54 test.htmlApache2配置(/etc/apache2/apache2.conf):
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>发布于 2018-06-18 09:42:50
有一个错误:
根据ls给出的文件列表,您的图像文件是.jpg文件,而不是.png文件。
您可以检查您的html代码。
<html>
<head>
<title>test</title>
</head>
<body>
<img src="sniky.jpg">
</body>
</html>https://askubuntu.com/questions/1047550
复制相似问题