简体   繁体   中英

Apache2 relative paths not working

Good Morning, I am currently setting up and apache2 server on my raspberry pi. My index.html file is in the directory /var/www/html and the file is loading fine when I go to the IP address. However, the images located in /var/www/html/img are not loading. The html is like this: <img alt="image1" src="img/picture1.png"> . When I right click on the alternative image icon, and select open image in new tab, I get:

You don't have permission to access /img/picture1.png on this server.
Server unable to read htaccess file, denying access to be safe

How can I prevent this and make the user able to access the image?

Many thanks,

Try

chmod -R 755 /img/

this will set the permission for all files in the folder readable and executable for all, and also writable by the owner.

The output will be in the form

-rwxr-xr-x    1 root     root             0 Apr  5 12:38 picture1.jpg

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