• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Apache2 - Broken images load from remote server

yanover

New Pleskian
I have an apache2 server running under Ubuntu 18.04

Strangely, apache cannot display images, event though my browser load it with a 200 response message. If I trigger directly the image link, I can download it successfully, but the image cannot be open (wrong format), like it is broken.

This website used to work on another apache2 with approximately the same configuration.

I have tried to put an image file into the default folder (var/www) and display it with a simple src, it works !

My website that refuses to display images has this configuration in apache2.conf :

<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

And the virtualhost looks like this :

<VirtualHost *:80>
ServerName nasticot.lan
DocumentRoot /var/www/nasticot.lan
ServerAlias www.nasticot.lan
</VirtualHost>

/var/www is an SMB share mounted from a remote container.
The server has full rights on every file into this share (777)

There is also an .htaccess file at the root of the website

# Rewrite URL like xxx/yyy/zzz in index.php?controleur=xxx&action=yyy&id=zzz
RewriteEngine on
RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controleur=$1&action=$2&id=$3 [NC,L]

strangely, apache2 add content to my images on load.

I've verified one more time that my images are displayable directly in the folder read by my apache2 server, and it works.

If I download the image locally from the browser, the image has a few more line added to it.

My /var/www is a mounted share, located in my fileserver.

I found that this is the problem. If I copy the content of one of my website locally, images are displayed.

Event though I've full access to the mounted share :

root@coruscant:/var/www/nasticot.lan/Content/img/icon# ls -la /var/www
total 4
drwxrwxrwx 2 root www-data 0 Mar 20 15:54 .
drwxr-xr-x 14 root root 4096 Mar 20 19:31 ..
drwxrwxrwx 2 root www-data 0 Mar 24 11:08 nasticot.lan

And this is the share configuration in the fileserver :

[WWW]
path = /media/share/www
browseable = yes
writeable = yes
read only = no
force create mode = 0770
force directory mode = 2770
valid users = @sambashare

And finally, the fstab file on the webserver :

//192.168.0.53/WWW /var/www cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777,gid=www-data 0 0

Images file are loaded (200 OK) but broken ..

I wonder if php could break the image on load, I tried to set

*php.ini*

error_reporting = E_ALL
error_log = /var/log/php_errors.log

But I got nothing written into this log file so .. don't really know where to search ..

Please any help would be very appreciated


Any idea ?

Thank you !
 
Back
Top