"location ~ ^/phpmyadmin/(.*\.php)$" -->> How about all the other phpMyAdmin files that are not .php files?
This works for me (Replace 'proxy' with 'fastcgi').
[code]
server {
location ~ .+\.php$ {
# Return '400 Bad Request' for dodgy urls;
location ~ \..*/.*\.php$ {
return 400;
}
# Send others to proxy;
error_page 402 = @proxy;
return 402;
}
location ~ ^/phpMyAdmin/(.*)$ {
alias /server/path/to/phpMyAdmin/;
# Require authentication
auth_basic "Area-Name";
auth_basic_user_file htpasswd-file;
# Serve static files directly and pass dynamic requests to proxy;
try_files $uri $uri/ @proxy;
}
location @proxy {
proxy_pass http://127.0.0.1:xyz;
...
}
}
[/code]
The setup means all phpMyAdmin request go through the phpMyAdmin location first.
As said, swap fastcgi for proxy and should be good to go.