# Running phpmyadmin on non-standard dir

**URL:** <https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398>\
**Category:** NGINX\
**Created:** [February 3, 2012, 11:02am UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398 "2012-02-03T11:02:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 3, 2012, 11:02am UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/1 "2012-02-03T11:02:11Z")

</div>

hi. I’m new to Nginx.  
I’d like to make serve phpmyadmin on a non-standard url.  
I’m on debian, and following this howto works great:  
[http://rubyist-journal.com/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/](http://rubyist-journal.com/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/)

but if I change it this way:

```
location /pma {
       root /usr/share/phpmyadmin/;
       index index.php index.html index.htm;
       location ~ ^/(.+\.php)$ {
               try_files $uri =404;
               root /usr/share/phpmyadmin/;
               fastcgi_pass backend;
               fastcgi_param HTTPS $fastcgi_https;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME

```

$document\_root$request\_filename;  
include /etc/nginx/fastcgi\_params;  
}  
}

I just get 404.  
2 questions:

- how to make it properly work?
- how to debug these config errors?

thanks a lot!  
maxxer

Posted at Nginx Forum:

> **[running phpmyadmin on non-standard dir](https://forum.nginx.org/read.php?2,221927,221927#msg-221927)**
>
> hi. I'm new to Nginx. I'd like to make serve phpmyadmin on a non-standard url. I'm on debian, and following this howto works great: http://rubyist-journal.com/2010/02/28/howto-nginx-php5-mysql-phpmyadmin-ubuntu-shortest-setup/ but if I change it this...

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 11:39am UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/2 "2012-02-03T11:39:24Z")

</div>

(complete answer on the bottom)

On Fri, Feb 3, 2012 at 5:01 PM, maxxer [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> - how to debug these config errors?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

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 - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 11:54am UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/3 "2012-02-03T11:54:15Z")

</div>

[http://www.howtoforge.com/running-phpmyadmin-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04](http://www.howtoforge.com/running-phpmyadmin-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04)

Works with cgi.fix\_pathinfo on and off.

----- Original Message -----  
From: “maxxer” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Friday, February 03, 2012 11:01 AM  
Subject: running phpmyadmin on non-standard dir

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 12:00pm UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/4 "2012-02-03T12:00:28Z")

</div>

## Falko T. Wrote:

> [http://www.howtoforge.com/running-phpmyadmin-on-ng](http://www.howtoforge.com/running-phpmyadmin-on-ng)  
> inx-lemp-on-debian-squeeze-ubuntu-11.04
> 
> Works with cgi.fix\_pathinfo on and off.

thanks Falko, I’m usually a great fan of your howtos, but I with to  
serve phpmyadmin on the url /pma instead of /phpmyadmin, and I wasn’t  
able to tweak the config to do this…

Edho thanks, but your config makes the /pma url redirect to /phpmyadmin,  
and download the source of index.php.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,221927,221934#msg-221934](http://forum.nginx.org/read.php?2,221927,221934#msg-221934)

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 12:14pm UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/5 "2012-02-03T12:14:03Z")

</div>

On Fri, Feb 3, 2012 at 5:59 PM, maxxer [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Edho thanks, but your config makes the /pma url redirect to /phpmyadmin,  
> and download the source of index.php.

Sorry, I forgot a tilde.

location ~ /pma/(.\*.php)$ {

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 5:11pm UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/6 "2012-02-03T17:11:26Z")

</div>

If you are inexperienced, do not run phpmyadmin publically as  
/phpmyadmin or you will fall behind a security update to find your  
system compromised (and now the new member in the botnet!) I used to  
hunt botnets for awhile and PhpMyAdmin was a common way to get in

---

<div class="post-metadata">

**Author:** ![maxxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maxxer](https://www.ruby-forum.com/u/maxxer)\
**Post date:** [February 3, 2012, 5:37pm UTC](https://www.ruby-forum.com/t/running-phpmyadmin-on-non-standard-dir/216398/7 "2012-02-03T17:37:29Z")

</div>

On 3 Fev 2012 16h10 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If you are inexperienced, do not run phpmyadmin publically as  
> /phpmyadmin or you will fall behind a security update to find your  
> system compromised (and now the new member in the botnet!) I used to  
> hunt botnets for awhile and PhpMyAdmin was a common way to get in

Yep. There’s a FD post by the Gentoo security team that exposes what  
an utter complete wreck security wise phpmyadmin is:

> **[Full Disclosure: \[GLSA 201201-01 \] phpMyAdmin: Multiple	vulnerabilities](https://seclists.org/fulldisclosure/2012/Jan/39)**

Use Chive: [http://www.chive-project.com](http://www.chive-project.com)

Don’t forget to set: cgi.fix\_pathinfo = 0 on the php.ini.

You’re gaining something in security terms by choosing Nginx over  
Apache, don’t throw that under a bus by using phpmyadmin.

— appa
