Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

    listen 8080;
    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_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
        include         /opt/nginx/conf/fastcgi_params;


When I go to it works as expected! but after submitting username/password it redirects me to with page cannot be found response as well!

What could I do?

share|improve this question

4 Answers 4

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

$cfg['PmaAbsoluteUri'] = '';

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).

share|improve this answer

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.

share|improve this answer
This worked for me - added this in /etc/nginx/conf.d/default... – zigojacko Jun 24 at 15:26

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 and - hope it gives you some idea where to look into phpmyadmin to correct this.

share|improve this answer

Read the wiki more:

share|improve this answer
Seriously?? Who was the -1? is the only correct answer. Some people here are so pedantic – Felipe Alcacibar Jan 23 '14 at 15:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.