Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Nginx - change phpmyadmin alias
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Nginx - change phpmyadmin alias

mehargagsmehargags Member
edited February 2015 in Help

Hi All,
I've been trying for hours to Rename PHPmyAdmin **as **abcmin without success. I'm setting up a Debian 7 VPS with Pure Nginx.

I've installed PHPMyAdmin with the following procedure, however I'd want that

apt-get install phpmyadmin -y
ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

put this at the end of the server block--/etc/nginx/sites-available/site.com

...
location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass unix:/var/run/php5-fpm.sock;
                       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;
        }

service php5-fpm restart && service nginx restart

I've tried renaming the symlink /usr/share/nginx/html/phpmyadmin to /usr/share/nginx/html/abcmin
but then I can't understand what to put in Serverblock. replacing phpmyadmin with "abcmin" doesn't work, I get 404.

I'm very new to nginx, please shed some light over this.

Thanks...

Comments

  • BlazeMuisBlazeMuis Member
    edited February 2015
    location /abcmin {
        index index.php;
        root PHPMYADMINLOCATION {

    Try that

  • mehargagsmehargags Member
    edited February 2015

    I tried that -- Gives bad gateway

    any tips regarding symlink creation ??

  • mehargags said: I tried that -- Gives bad gateway

    Have you also added the php-cgi/fastcgi/fpm parameter?

  • Make sure 'disable_symlinks off;'

  • im not renaming my 'PHPmyAdmin' but this maybe can help
    https://paste.ee/p/iTdV2#xHQUagyGyA5mvb0TrFXvMRcl6Bkznnum

    if just symlink no need to restart php5-fpm, just restart nginx ;p

  • Slightly offtopic, but have a look at Adminer. Less bloated, faster and definitely more secure than PMA.

  • Sorry Guyz... don't know its my internet connection or LET is not working properly. I've tried to tidy up the code tags.

    @vld... its for the Devs, you know how they are... will need PMA -- I know adminer is great too!

    @mustafaramadhan pls explains where to put this disable_symlinks off ?? in Server block ?

  • Yes, in 'server {}'.

    BTW, instead using packages, why not downloading from phpmyadmin.net?.

  • Well what differece does it make @mustafaramadhan ?

    Anyways I saw a tutorial here http://ofamilymedia.com/2011/11/configure-phpmyadmin-with-nginx/

    I'm just taking it over my head, but this time I get No input file specified. So I guess the alias is working but it is not finding the PHP files to execute

    location /secretdb {
      alias /usr/share/phpmyadmin/;
      try_files $uri $uri/ /index.php;
    }
    location ~ ^/secretdb(.+\.php)$ {
      alias /usr/share/phpmyadmin$1;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
      include fastcgi.conf;
      fastcgi_intercept_errors        on;
      error_page 404 /error/404.php;
    }
    
  • Hi, @mehargags.

    Try this:

    location /abcmin {
    alias /usr/share/phpmyadmin;
    index index.php index.html index.htm;
    location ~ ^/abcmin/(.+.php)$ {
    alias /usr/share/phpmyadmin/$1;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$1;
    }
    location ~* ^/abcmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
    alias /usr/share/phpmyadmin/$1;
    }
    }




    Please check if you can open phpmyadmin from: http://YOUR_VPS_IP/abcmin

  • mehargagsmehargags Member
    edited February 2015

    hi @Imam86,
    thanks for your code, but it still doesn't resolve.... gives me
    No input file specified.

    while it looked the most comprehensive... I'm sure there is a small thing we are missing.

  • You created a symlink in /usr/share/nginx/html but in your server block the root is in /usr/share/

  • @mehargags, Then it must be wrong with your fastcgi_params.

    1) Please create a new file: /etc/nginx/fastcgi_myparams, like this:


    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_param SCRIPT_FILENAME $request_filename;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param HTTPS $https if_not_empty;
    fastcgi_param REDIRECT_STATUS 200;




    2) And from my code before, search for the line:


    include fastcgi_params;


    change it with:


    include fastcgi_myparams;

    Because I'm using phpmyadmin path in /home/imam86/Website/phpmyadmin/public_html, and it's working. (^_^)

  • mehargagsmehargags Member
    edited February 2015

    Oh -- Thanks a ton @Imam86 --- you nailed it!

    I just matched the params list with your and found I had 2 mismatches:

    First I had this Extra entry -- which I made myself reading from somewhere:
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
    My PHP Pages were being Served as blank White pages, adding the above fixed it. The moment I commented that code, the abcmin-->PHPMyAdmin started working!

    but then again -- PHP pages went blank

    I again matched the params and noticed I had this MISSING ->
    fastcgi_param SCRIPT_FILENAME $request_filename;
    I added that and voila... PHP started working too!

    So you helped me fix rather two issues! Thanks alot!

    I'm just 3-4 days old with NGinx, and the Directives are little confusing to grasp early! I'm sure great members like you are going to help alot.

    Thanks a million!

  • I was actually trying to do something like this earlier today, thanks for the thread it helped me out :) I had settled on adminer because I didn't want to bother with getting phpmyadmin the way I wanted but I'll give it another shot.

  • @Sin... I'm glad it helped you...
    Adminer looks like to be the future, but you know the conventional developers and regular staffers have hard time using a new interface, hence it is needed to have phpma, atleast for now!

  • edited February 2015

    @mehargags,

    Why not install phpmyadmin and adminer together for transition.

    See cp.mratwork.com to know how I am doing for this situation.

  • I agree @mustafaramadhan. We sysAdmins should start pushing it!
    I will definitely install Adminer and propose that to be used... !

Sign In or Register to comment.