Apache is not displaying images regardless of file type (jpg,png,gif). No entries in the error.log, access.log is showing no abnormalities. Permissions are correct, I am not getting "forbidden" message when trying to accessing the img url directly: "hostname.domain.domain/xxx.jpg" I just get nothing displayed, same on WINDOWS Client using multiple browsers and on Mac using multiple browsers. On local LAN the issue is the same as with remote internet connection accessing the site.

read about this similar issue for ubuntu 12.x with apache where disabling "EnableSendFile" fixes an issue similar to this but per Apache documentation this feature is disabled by default and can be enabled via the apache2.conf file.

Anyone else having this issue? This is not a production server, just wanted to learn more about web hosting on Linux/Apache platform.

I've applied the following command to just be sure its not permissions:

sudo chmod -R 755 /var

/var/www/html/ {web files hosted here}

drwxr-xr-x  13 root root  4096 Jun 11 12:06 var
drwxr-xr-x  3 root root 4096 Jun 11 12:02 www
drwxr-xr-x  3 root root 4096 Jun 11 21:50 html

user@domain:/$ ls -la /var/www/html

drwxr-xr-x 3 root root  4096 Jun 11 21:50 .
drwxr-xr-x 3 root root  4096 Jun 11 12:02 ..
-rwxr-xr-x 1 root root    70 Jun 11 21:50 1.jpg
-rwxr-xr-x 1 root root   135 Jun 10 16:25 cat.jpg
-rwxr-xr-x 1 root root   113 Jun 10 16:26 frog.jpg
-rwxr-xr-x 1 root root     5 Jun 10 16:51 frog.png
-rwxr-xr-x 1 root root 11510 Jun  9 21:10 index.html
-rwxr-xr-x 1 root root   574 Jun 11 23:34 index.php

index.php code: (Planning to add PHP code in the future)

< img src="frog.png" alt="FROG" >

Access Log:

12/Jun/2016:18:46:12 -0500] "GET /frog.png HTTP/1.1" 200 284 "http://hostname.domain/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36"

Testing: hostname.domain/frog.png (frog.png is in /var/www/html; testing in web browser)

Error received on web browser when I remove that specific file "frog.png" from the html directory:

Not Found

The requested URL /frog.png was not found on this server.

tried the same test with frog.jpg with no success. when I put the file back in /var/www/html I no longer get the above error message, but the image does not appear either, I get a little box in the top left corner of the web page. Tested on Chrome, fireFox, IE and Safari all provided the same results.

  • 1
    frog.png is only 5 bytes, which doesn't seems to me to be enough. I think the little box in the top left corner might be all you asked for. – Doug Smythies Jun 13 '16 at 0:11
  • 1
    Umm, I'm afraid you've broken your computer with sudo chmod -R 755 /var – Tim Jun 13 '16 at 0:21
  • askubuntu.com/questions/137181/… – Tim Jun 13 '16 at 0:22
  • Tim, Not sure what you mean, took a glance at that link you provided, all my services are operating from what i can tell. only issue is that the images are not loading. like i stated above, i dont believe the issue is with permissions, but i'm a linux noob so any help is appreciated! – G22 Jun 13 '16 at 3:55
  • Doug, I tried all the image files in the /html directory with the same results. – G22 Jun 13 '16 at 3:56

I have apache2 on Ubuntu 16.10. When you started apache, make sure to use the apache2ctl command as aposed to the apache2 command. Ubuntu customizes apache quite a bit, so try using sudo apache2ctl start

  • i just tried restarting the apache server with that command instead and no luck. – G22 Jun 13 '16 at 3:53
  • have you checked to make sure you have valid image files? – PMiner Jun 14 '16 at 15:00
  • also, have you tried using external links to images? for example, < img src="cid-9d9e1de589cb7f96.users.storage.live.com/users/…" alt="FROG" > try that and tell me if you see a pineapple with a glowing background – PMiner Jun 14 '16 at 15:03

Doug, thank you for making me double check my img files! that was the issue, when using tftp to transfer my image files over from windows machine i did not use the "-i" and for some reason it was not sending the complete file over to the server. I transfered the complete cat.jpg file of 68kb over to the server and it now works like a charm! thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.