5

I installed Nginx, Varnish and PHP-fpm. Then I installed PHPmyAdmin and made a virtual host for it:

server{
    listen 8080;
    server_name phpmyadmin.Domain.com;
    access_log /var/log/phpmyadmin.access_log;
    error_log /var/log/phpmyadmin.error_log;

    location / {
      root /usr/share/phpmyadmin;
      index index.php;
    }

    location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
        include         /opt/nginx/conf/fastcgi_params;
    }

}

When I go to phpmyadmin.Domain.com it works as expected! but after submitting username/password it redirects me to phpmyadmin.Domain.com:8080/index.php?... with page cannot be found response as well!

What could I do?

amrnt
  • 359
  • 1
  • 3
  • 9

4 Answers4

6

Just came across this same problem myself. The solution is to modify config.inc.php and specify the absolute URL to your phpMyAdmin installation. As per the phpMyAdmin Documentation, add:

$cfg['PmaAbsoluteUri'] = 'http://your.domain.com/path/to/phpmyadmin/';

In this case, it is not necessary to add port_in_redirect off; to the nginx config - although doing does not appear to have any adverse effect (and does help in other scenarios).

cyberx86
  • 20,805
  • 1
  • 62
  • 81
2

Just add the following line in your nginx configuration file, in the php location block anywhere after the include fastcgi_params part:

fastcgi_param   SERVER_PORT 80;

This will tell php that it should not try to redirect to whatever port nginx is listening to, but stay on port 80 as is meant with varnish.

damusnet
  • 325
  • 1
  • 2
  • 11
0

Probably something in phpmyadmin php files/settings wise looking for standard port 80. Pretty common it seems with some scripts and Varnish i.e. with vbulletin and 4images script similar issues http://vbtechsupport.com/290/ and http://vbtechsupport.com/303/ - hope it gives you some idea where to look into phpmyadmin to correct this.

p4guru
  • 963
  • 1
  • 8
  • 16
0

Read the wiki more: http://wiki.nginx.org/HttpCoreModule#port_in_redirect

Martin Fjordvald
  • 7,749
  • 1
  • 30
  • 35