Hi,
So it seems that mginx can’t read a url with .png, for example
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 permissions do you have set on the folder? And how are you
directing requests to the folder? Can you show us ur config?
Sent from my BlackBerry device on the Rogers Wireless Network
Is it also possible to change my php directive to:
location ~ .php$ { root html;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME html$fastcgi_script_name;
include fastcgi_params; }
?? Will it do the same?
On Sun, Feb 27, 2011 at 04:47:00AM +0000, Aditya H. 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 D. [email protected]
The folder should have read access… I don’t know what you mean by
redirecting requests to folder. I just noticed that it can’t also read
css, js, and png, jpg!!
Here’s my error log:
011/02/27 05:53:29 [error] 18679#0: *225 open()
“/usr/local/nginx/html/phpMyAdmin/js/mooRainbow/mooRainbow.css” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/js/mooRainbow/mooRainbow.css
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:53:29 [error] 18679#0: *226 open()
“/usr/local/nginx/html/phpMyAdmin/print.css” failed (2: No such file or
directory), client: 70.176.18.156, server: localhost, request: “GET
/phpMyAdmin/print.css HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:53:29 [error] 18679#0: *228 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/logo_right.png”
failed (2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/logo_right.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:53:29 [error] 18679#0: *223 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/b_help.png” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/b_help.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:53:29 [error] 18679#0: *227 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/s_warn.png” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/s_warn.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:53:29 [error] 18679#0: *227 open()
“/usr/local/nginx/html/phpMyAdmin/favicon.ico” failed (2: No such file
or directory), client: 70.176.18.156, server: localhost, request: “GET
/phpMyAdmin/favicon.ico HTTP/1.1”, host: “50.56.81.42”
2011/02/27 05:54:39 [error] 18679#0: *237 open()
“/usr/local/nginx/html/phpMyAdmin/print.css” failed (2: No such file or
directory), client: 70.176.18.156, server: localhost, request: “GET
/phpMyAdmin/print.css HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:54:39 [error] 18679#0: *235 open()
“/usr/local/nginx/html/phpMyAdmin/js/mooRainbow/mooRainbow.css” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/js/mooRainbow/mooRainbow.css
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:54:39 [error] 18679#0: *238 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/logo_right.png”
failed (2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/logo_right.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:54:39 [error] 18679#0: *239 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/b_help.png” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/b_help.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
2011/02/27 05:54:39 [error] 18679#0: *233 open()
“/usr/local/nginx/html/phpMyAdmin/themes/original/img/s_warn.png” failed
(2: No such file or directory), client: 70.176.18.156, server:
localhost, request: “GET /phpMyAdmin/themes/original/img/s_warn.png
HTTP/1.1”, host: “50.56.81.42”, referrer:
“http://50.56.81.42/phpMyAdmin/main.php”
Here’s my config:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local]
“$request” ’
# '$status $body_bytes_sent “$http_referer” ’
# ‘“$http_user_agent” “$http_x_forwarded_for”’;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
}
# another virtual host using mix of IP-, name-, and port-based
configuration
#
Server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
On Feb 27, 2011, at 18:35 , Aditya H. wrote:
?? Will it do the same?
Please read this
How nginx processes a request
Above server_name localhost;
- root html;
I don’t get it…what do you mean?
thanks it works now…can you explain what’s going on
sorry, but no… I tried again and it still failed…it’s the caching
that makes it like it works
From: [email protected]
To: [email protected]
Date: Sun, 27 Feb 2011 07:23:30 +0000
Subject: RE: nginx can’t read images
thanks it works now…can you explain what’s going on