Apache2 相对路径不起作用
Apache2 relative paths not working
早上好,
我目前正在 raspberry pi 上设置 apache2 服务器。我的 index.html
文件在目录 /var/www/html
中,当我转到 IP 地址时文件加载正常。但是,位于 /var/www/html/img
的图像未加载。 html 是这样的:<img alt="image1" src="img/picture1.png">
。当我右键单击替代图像图标并 select 在新选项卡中打开图像时,我得到:
You don't have permission to access /img/picture1.png on this server.
Server unable to read htaccess file, denying access to be safe
如何防止这种情况发生并使用户能够访问图像?
非常感谢,
尝试
chmod -R 755 /img/
这将设置文件夹中所有文件的权限,所有人都可以读取和执行,并且所有者也可以写入。
输出格式为
-rwxr-xr-x 1 root root 0 Apr 5 12:38 picture1.jpg
早上好,
我目前正在 raspberry pi 上设置 apache2 服务器。我的 index.html
文件在目录 /var/www/html
中,当我转到 IP 地址时文件加载正常。但是,位于 /var/www/html/img
的图像未加载。 html 是这样的:<img alt="image1" src="img/picture1.png">
。当我右键单击替代图像图标并 select 在新选项卡中打开图像时,我得到:
You don't have permission to access /img/picture1.png on this server.
Server unable to read htaccess file, denying access to be safe
如何防止这种情况发生并使用户能够访问图像?
非常感谢,
尝试
chmod -R 755 /img/
这将设置文件夹中所有文件的权限,所有人都可以读取和执行,并且所有者也可以写入。
输出格式为
-rwxr-xr-x 1 root root 0 Apr 5 12:38 picture1.jpg