phpmyadmin problem nginx reverse proxy

Posted October 11, 2013 29.2k views
I configured nginx with apache2. it seems works, but I can not log in. it shows me the site is unavailable when I type my password and submit. then I retype mydomain/phpmyadmin/ once again I logged into the admin. How is it possibe? phpmyadmin nginx block: location ~* ^/phpmyadmin { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 32k; proxy_buffers 8 16k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; }

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
8 answers
I just spent a good long while trying to get this to work on my setup. Basically exactly the same with an Nginx reverse proxy onto an apache backend with phpmyadmin in a subdirectory.

The thing that fixed it for me was to set the phpmyadmin config variable


to the url that your users should see. In my case it was something like

$cfg['PmaAbsoluteUri'] = '';

I did manage to get Nginx to rewrite the redirects correctly in order to let me in but I found phpmyadmin was riddled with links that were incorrect so I figured fixing my Nginx configuration was not the solution.
by Etel Sverdlov
This tutorial covers the installation of phpMyAdmin on a LEMP server (as opposed to a LAMP server). phpMyAdmin is a free software to work with MySQL on the web—it provides a convenient visual front end to the capabilities of MySQL.
yes Ive tried everything but does not work. :(( always redirect to :8080 but works on :80 if I manually retype to :80

ports in redirect mode is useless :(
What's the benefit of having a reverse proxy for phpMyAdmin? Why not simply configure it with either Nginx or Apache?
Try adding proxy_redirect off, does it fix it?
I'm also interested in a solution for this.

@Pablo - the benefit of running nginx and Apache in this configuration are that you use nginx for serving static pages (nginx being an event-based web server) and all PHP requests are handed off to Apache to do the heavy lifting (Apache being process-based). This way Apache isn't drilling into server memory just to serve static pages as nginx can handle that more efficiently.

@Kamal - adding proxy_redirect off; to the server block doesn't fix this. When you send the login request, nginx passes off the request to Apache for processing, but I believe that Apache is trying to send the request straight out rather than back to nginx.

@xpbazsi - have you tried changing the authentication method from cookie to another method e.g. http? PMA documentation lists some info about cookie auth not working from an Apache reverse proxy (
The problem is that your apache virtual host is named *8080
In your ports.conf change it to;
NameVirtualHost * instead of NameVirtualHost *:8080 or whatever it is. Keep the Listen 8080 part
Next go into sites-enabled and edit your 000-default and edit the line instead of
restart apache
it didnt like that last code block as..
in the 000-default file edit the [VirtualHost *] instead of [VirtualHost *:8080]
the [ ] and suppose to be angle brackets btw