Take the 2-minute tour ×
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;
    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_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?

share|improve this question

4 Answers 4

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

share|improve this answer

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.

share|improve this answer

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

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

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

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.