My APACHE2 server is not displaying images.

Marco59790 -  
 MMD54 -
Hello everyone,

I'm experiencing a problem with my APACHE2 server that doesn't display images.
I've been looking for a solution for 4 days, but I'm starting to hit a wall.
And for once, even on CCM, I haven't found the solution.

Indeed, no matter which browser I use, my images do not display.
When I try to access an image.png that's located at the root of my web server, I get this message on Firefox: The image "h t t p ://192.168.0.10/chrome.png" cannot be displayed because it contains errors.

I've checked with other images, same problem; my image was tested on another Apache server at work and it displays correctly.

My server is running on Debian 6 with Apache 2.

Thank you in advance for your help.

Configuration: Windows 7 / Internet Explorer 8.0

7 réponses

Selmak Carter
 
Hi,

I think your problem is due to permissions, if you have properly installed your server.
For example, if in your /var/www folder there are:

- index.html
- style.css


and a directory images containing image files (.png, .jpeg, etc..)

You need to grant read and execution permissions.
To do this, open the terminal, then type these commands:

su cd /var/www


Then check the permissions by typing
ls -l

I get this:

drwxr--r-- 2 root root 4096 13 Mar 14:15 images -rw-r--r-- 1 root root 3007 13 Mar 14:15 index.html -rw-r--r-- 1 root root 2480 13 Mar 14:15 style.css 

As you can see, my images folder does not have access permissions for the 'group' and 'all'

So, when you use your browser, it won't display the images in the /var/www/images directory
Therefore, you just need to type these commands in your terminal:

chmod 755 images /etc/init.d/apache2 restart


Then open your browser, type 127.0.0.1, and press "F5"
Of course, you will need to adapt this example to your case.

Given your problem, I don't think it's due to the firewall since only your images are not displaying, whereas everything goes through port 80 unless you need to configure some configuration files on Apache (folder access), meaning you need to specify to Apache where your images are located and also grant the necessary permissions.
1
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Hello,

I took the liberty of removing the bold tags.
Otherwise, he can see his image on the server.
0
Selmak Carter
 
OK, but I saw that he was talking about two servers, one at his work and the other locally,
if I understood correctly, he wants to display his images locally (192.168.0.10), because on Debian the port 80 is open by default, as soon as you install APACHE, PHP, MYSQL everything is already set up.
Anyway, if he sees his images locally, I think he will also need to configure his router.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Re,

by default, as soon as you install APACHE, PHP, MYSQL everything is already ready.
Absolutely.

I think he will also have to configure his router.
Indeed.
If he wants to access his server from outside, he has no choice. He should set up a port forwarding on his router.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Hello,

Did you make any changes in the configuration file?

Show the result of
apache2ctl -M rgrep documentroot /etc/apache2 -i 


GNU/Linux: Linux is Not Ubuntu! Which Linux to choose does not mean your favorite Distribution,
106485010510997108
0
Marco59790
 
I made few modifications to the apache2.conf file

here is the result of apache2ctl -M
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
perl_module (shared)
php5_module (shared)
python_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK

root@192.168.0.10:~# rgrep documentroot /etc/apache2 -i
/etc/apache2/sites-enabled/000-default: DocumentRoot /var/www
/etc/apache2/sites-available/pcc: DocumentRoot /var/www/PCC/
/etc/apache2/sites-available/default: DocumentRoot /var/www
/etc/apache2/sites-available/default-ssl: DocumentRoot /var/www
/etc/apache2/httpd.conf:DocumentRoot /var/www

Thank you for your response and your analysis.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
/etc/apache2/httpd.conf:DocumentRoot /var/www
The httpd.conf file (which is basically useless on Debian, I've always hated the way Debian developers have configured Apache) should be empty.

Is your image located in /var/www?
0
Marco59790
 
Yes, my image is located in /var/www
What do you recommend for the httpd.conf?
Should I leave it empty
Thank you for your answers.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Display

file /var/www/chrome.png


What do you recommend for the httpd.conf?
I don't know what you've put in there. By default, it's empty.
Display
cat /etc/apache2/httpd.conf


/etc/apache2/sites-available/pcc: DocumentRoot /var/www/PCC/
What is pcc? A virtual host?
0
Marco59790
 
root@192.168.0.10:/etc/apache2# file /var/www/chrome.png
/var/www/chrome.png: PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced

don't worry about /etc/apache2/sites-available/pcc: DocumentRoot /var/www/PCC/
I was trying out the virtual host but I'll look into that later.

I just emptied the httpd.conf but nothing changes, my apache2 server is not displaying images.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Restart your Apache server.
As root
/etc/init.d/apache2 stop /etc/init.d/apache2 start


Still as root
>/var/log/apache2/error.log >/var/log/apache2/access.log


Then go to http://localhost/chrome.png and display (still as root)
cat /var/log/apache2/{access,***,error}.log
0
Marco59
 
``` root@PANDORA:~# /etc/init.d/apache2 stop
Stopping web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand ... waiting .
root@PANDORA:~# /etc/init.d/apache2 start
Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand
root@PANDORA:~# ps -eaf|grep apache
root 2903 1 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2910 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2911 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2912 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2913 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2914 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
root 2919 2145 0 12:44 pts/0 00:00:00 grep apache
root@PANDORA:~#

root@PANDORA:~# cat /var/log/apache2/{access,***,error}.log
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)" ```
0
Marco-fever Posted messages 3 Status Membre
 
root@PANDORA:~# /etc/init.d/apache2 stop
Stopping web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand ... waiting .
root@PANDORA:~# /etc/init.d/apache2 start
Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand
root@PANDORA:~# ps -eaf|grep apache
root 2903 1 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2910 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2911 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2912 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2913 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2914 2903 0 12:43 ? 00:00:00 /usr/sbin/apache2 -k start
root 2919 2145 0 12:44 pts/0 00:00:00 grep apache
root@PANDORA:~#

The image displays well locally on the Linux server via iceweasel.

root@PANDORA:~# cat /var/log/apache2/{access,***,error}.log
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"
localhost:80 ::1 - - [13/Mar/2011:08:02:42 +0100] "OPTIONS * HTTP/1.0" 200 136 "-" "Apache (internal dummy connection)"

Sorry for the late reply CCM delete all my messages (I don't understand why) I signed up we'll see where the new nickname comes from.

Thank you for your response.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
I have restored all your messages.
Apparently, your image is displaying.
I will give you some explanations later.
0
Marco-fever Posted messages 3 Status Membre
 
Okay, thank you.
As for my image, yes, it displays correctly locally on the server.
I don't understand.
I read that Debian has a firewall? Should it be configured?
Thank you for your help.
0
lami20j Posted messages 21506 Registration date   Status Modérateur, Contributeur sécurité Last intervention   3 570
 
Re,

root@192.168.0.10:~# /etc/init.d/apache2 start
-bash: /etc/init.d/apache2: No such file or directory <== I don't quite understand!!


It's normal.
You typed ect instead of etc

Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand
It's just a warning.
To get rid of it, simply add in /etc/apache2/apache2.conf the directive
ServerName 127.0.0.1

I read that Debian has a firewall? Should it be configured?
In GNU/Linux systems, the firewall is integrated into the kernel and is called netfilter

Access to the server can be configured on the server side as well as on the firewall side.
You should read the documentation.

GNU/Linux: Linux is Not Ubuntu! Which Linux to choose doesn't mean your favorite distribution,
106485010510997108
0
Marco-fever Posted messages 3 Status Membre
 
Even changing the rights doesn't work.
I also tried changing the owner, but that doesn't work either.

Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ==> I don't understand.
It's just a warning.
To get rid of it, just add the directive
ServerName 127.0.0.1 in /etc/apache2/apache2.conf ==> thanks, it works; no more error messages.

Now I don't understand anything; I briefly managed to display the images on FIRE FOX, but as soon as I test on IE8, no images, just a nice red cross instead. And then when I went back to FIRE FOX, nothing!!! I'm despairing.... -_-

h t t p://192.168.0.10/images_page/interdit.png
The image "http://192.168.0.10/images_page/interdit.png" cannot be displayed because it contains errors.

Thank you for your help.
0
MMD54
 
Did you find the solution because I have the same problem as you but with a Raspberry Pi!
Please.

MMD
0