running phpmyadmin on non-standard dir

Edho Arief edho at
Fri Feb 3 10:38:38 UTC 2012

(complete answer on the bottom)

On Fri, Feb 3, 2012 at 5:01 PM, maxxer <nginx-forum at> wrote:
> hi. I'm new to Nginx.
> I'd like to make serve phpmyadmin on a non-standard url.

There's no "standard url". Learn how "root" (and "alias") directive work.

> * how to make it properly work?

> * how to debug these config errors?

location = /pma { rewrite ^ /pma/ permanent; }
location /pma/ {
  location /pma/(.*\.php)$ {
    set $script_filename /usr/share/phpmyadmin/$1;
    # testing file existence for security.
    # sadly in this case we can't use try_files since we're testing
against actual file on disk
    # while try_files tries against uri
    if (!-f $script_filename) { return 404; }
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $script_filename;
    fastcgi_param HTTPS $fastcgi_https;
    fastcgi_pass backend;
  location ~ ^/pma(|/.*)$ {
    alias /usr/share/phpmyadmin/$1;
    index index.php;

O< ascii ribbon campaign - stop html mail -

More information about the nginx mailing list