The phpmyadmin files are located here /usr/share/phpmyadmin/

And I have this server block code that allows me to access phpmyadmin only from http://vps-ip/:

server {
        listen 80; ## listen for ipv4; this line is default and implied
        #listen [::]:80 default ipv6only=on; ## listen for ipv6
        root /usr/share/phpmyadmin/;
        index index.php index.html index.htm;
        server_name ein;

        location / {
                root /usr/share/phpmyadmin/;
                index index index.php;
                try_files $uri/ $uri /index.php?q=$uri&amp&$args;
                port_in_redirect off;

        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
                access_log off;
                log_not_found off;
                expires max;
                root /usr/share/phpmyadmin/;

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                fastcgi_pass php;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_param QUERY_STRING $query_string;
                fastcgi_param REQUEST_METHOD $request_method;
                fastcgi_param CONTENT_TYPE $content_type;
                fastcgi_param CONTENT_LENGTH $content_length;
                fastcgi_intercept_errors on;
                fastcgi_ignore_client_abort off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 360;
                fastcgi_read_timeout 360;
                fastcgi_buffer_size 128k;
                fastcgi_buffers 8 256k;
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;

        location ~ /.htaccess { deny all; log_not_found off; access_log off; }
        location ~ /.htpasswd { deny all; log_not_found off; access_log off; }
        location = /favicon.ico { allow all; log_not_found off; access_log off; }
        location = /robots.txt { allow all; log_not_found off; access_log off; }

What changes I need to do in order to access phpmyadmin from http://vps-ip/phpmyadmin and access my website from http://vps-ip/ ?

OK I found the solution for this:

location ^~ /phpmyadmin/ { 
    alias /usr/share/phpmyadmin/; 

    location ~ \.php$ { 
    include fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $request_filename; 
    fastcgi_pass php; 

2 Answers 2


The act of doing this is called Aliasing, basically setting something to go to somewhere else. I personally don't have experience with NGINX but According to this post, you should be using:

location /phpmyadmin/ {
    alias /usr/share/phpmyadmin/;

Hopefully this helps. :)

  • I added this location, now when I go to my-ip/phpmyadmin I get "No input file specified."
    – Danny
    Jun 6, 2012 at 22:51
  • OK I copied exactly the same code from the question that you linked and that fixed my problem. So here's the solution again serverfault.com/questions/223028/…
    – Danny
    Jun 7, 2012 at 0:50

You need to change your root. Right now you have it as root /usr/share/phpmyadmin/. This means nginx thinks http://vps-ip/ should be served from /usr/share/phpmyadmin/. Are the files you want to share at http://vps-ip/ located in /usr/share/? (That seems like a really odd place for them, you should probably make a folder for your website).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .