- 
      
 - 
        
Save tsolar/6429503 to your computer and use it in GitHub Desktop.  
| server { | |
| location /phpmyadmin { | |
| root /usr/share/; | |
| index index.php index.html index.htm; | |
| location ~ ^/phpmyadmin/(.+\.php)$ { | |
| try_files $uri =404; | |
| root /usr/share/; | |
| fastcgi_pass 127.0.0.1:9000; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include /etc/nginx/fastcgi_params; | |
| } | |
| location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { | |
| root /usr/share/; | |
| } | |
| } | |
| location /phpMyAdmin { | |
| rewrite ^/* /phpmyadmin last; | |
| } | |
| } | 
This is also the only configuration that is working for me, thank you.
How would you change the publicly accessible name /phpmyadmin into /othername?
@mqandalle,
To change /phphmyadmin to /othername
This article is helpful for you: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-ubuntu-16-04
@mquandalla and @tsolar I am working on windows server where using nginx and mysql server using xampp. using above code and replacing root  with the path as per windows machine I tried to use your code But it didn't worked.
Plz help
server { location /phpmyadmin { root C:\xampp\mysql\share\; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include D:/nginx-1.14.0/conf/fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root C:\xampp\mysql\share\; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; } }
Hey, I've been using this gist for many years and it's working great.
phpmyadmin recently has changed its document root, and in version 6 it now properly uses a "public" subdirectory to expose its public files. There's also a nice redirect to ensure BC, but I find it a bit annoying and I'd love to be able to configure my location to serve files directly from that public dir.
I've tried the following, but hit a 404 wall. Do you have any suggestions? TIA
location /phpmyadmin {
    root /usr/src/phpmyadmin/public;
    index index.php;
    location ~ ^/phpmyadmin/public/(.+\.php)$ {
        try_files $uri =404;
        root /usr/src/phpmyadmin/public;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_read_timeout 180;
        include fastcgi_params;
    }
    location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/src/phpmyadmin/public;
    }
}
    
Thank you for posting this!
I spent hours trying to figure out how to put phpmyadmin on a subdirectory, and this was the first decent example I've come across. :-)