Ubuntu 16.04.5 LTS Xenial 4.18.8-x86_64-linode117
nginx version: nginx/1.10.3 (Ubuntu)
php v7.0.32-0ubuntu0.16.04.1`
/etc/nginx/sites-available/default
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
No symlink at /var/www/html
Worx well....
But I can't seem to figure out how to change phpmyadmin
url.
Tried creating a symlink whatever ->/usr/share/phpmyadmin
or whatever ->/usr/share/phpmyadmin/
under /var/www/html
does not work,
Even if I change /etc/nginx/sites-available/default
to:
location /whatever {
root /usr/share/phpmyadmin/;
Created a symlink as mentioned above, restarted both nginx
& php7.0-fpm
still the new URL tried to download the page...
Looked up different resources on the net but they dont help:
digitalocean's guide
devanswers guide
As well as other here on SO but couldn't find a solution.
Ideas??
UPDATE
By Richard Smith's remark
location /whatever {
alias /usr/share/phpmyadmin;
index index.php index.html index.htm;
if (!-e $request_filename) { rewrite ^ /phpmyadmin/index.php last; }
# Secure phpMyAdmin Instance
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/.your_pass_file;
client_max_body_size 68M;
location ~ ^/phpmyadmin/(.+\.php)$ {
if (!-f $request_filename) { return 404; }
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
alias /usr/share/phpmyadmin;
}
}