Alias causing phpMyAdmin login endless loop

Dayo nginx-forum at
Fri Feb 18 19:40:50 MSK 2011

"location ~ ^/phpmyadmin/(.*\.php)$" -->> How about all the other
phpMyAdmin files that are not .php files?

This works for me (Replace 'proxy' with 'fastcgi').

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 {

The setup means all phpMyAdmin request go through the phpMyAdmin
location first.

As said, swap fastcgi for proxy and should be good to go.

Posted at Nginx Forum:,166700,176509#msg-176509

More information about the nginx mailing list