I am having a problem with my nginx server.
I am fairly new to nginx, so the config files aren't my strongest (yet)
I have this default.conf in /etc/nginx/conf.d/:
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# 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;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$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;
}
location /phpMyAdmin {
root /usr/share;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /usr/share;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
but when I access <ServerIP>/phpMyAdmin
it just gives me a 404.
Log files are like this:
2012/09/18 19:12:53 [error] 3184#0: *1 open() "/usr/share/phpMyAdmin/nginx-logo.png" failed (2: No such file or directory), client: 1.2.3.4, server: _, request: "GET /phpMyAdmin/nginx-logo.png HTTP/1.1", host: "4.3.2.1", referrer: "http://4.3.2.1/phpMyAdmin/index.php"
What do I do wrong?
Here is the relevant code from my configuration. I struggled to get this working as well and I'm also new to nginx.
Try adding the trailing slash to the end of the root declaration in the location section.