nginx can't read images

Francis Daly francis at daoine.org
Sun Feb 27 15:50:35 MSK 2011


On Sun, Feb 27, 2011 at 04:47:00AM +0000, Aditya Herlambang wrote:

Hi there,

> So it seems that mginx can't read a url with .png, for example

nginx usually does exactly what you tell it to. In this case...

> http://20.16.31.42/phpMyAdmin/themes/original/img/logo_right.png
> that gives me a page not found. The ip address above has been changed (not the original one), it'sjust to give illustration. I checked that the file logo_right.png is in fact in that folder. What do I need to do to solve this?

...what folder is the file logo_right.png in?

Your config tells nginx to look for

/usr/local/nginx/html/phpMyAdmin/themes/original/img/logo_right.png

but your config also suggests that you wanted to tell nginx to look for

/usr/share/nginx/html/phpMyAdmin/themes/original/img/logo_right.png

Each (sub)request in nginx in handled by one location{} block, so you
must make sure that the correct config is in the location block that is
used for this specific request. Your location{} for .png urls uses the
compile-time document root value.

If this server is new, and not used for other files or services, then
the best change is probably to remove all "root" directives from your
nginx.conf, and add a single "root /usr/share/nginx/html;" outside all
location{}s, just after "server_name  localhost;"

Otherwise, you should probably add a "location /phpMyAdmin/ {}" which
contains other location{}s for the new urls you care about.

Note also that the distributed phpMyAdmin includes a few .htaccess files
to attempt to limit access to some files. There's nothing in your config
to mimic that, so unless you've taken other steps, you may be exposing
more that the phpMyAdmin developers consider wise.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list