How to install phpmyadmin on Ubuntu 16.04

Follow following steps to install phpmyadmin

sudo apt-get update

sudo apt-get install phpmyadmin

Move folder to /var/www

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

create separate nginx file for this

server {
listen 80;
listen [::]:80;

root /var/www/phpmyadmin;
index index.html index.htm index.nginx-debian.html;

server_name localphpmyadmin.com www.localphpmyadmin.com;

location / {
#try_files $uri $uri/ =404;
# original content
try_files $uri /index.php$is_args$args;
#try_files $uri $uri/ /index.php$is_args$args;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;

# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

 

Check nginx syntax error and restart nginx

sudo nginx -t

sudo systemctl restart nginx

Add an entry to your host file located at sudo nano /etc/hosts

127.0.1.1 localphpmyadmin.com

 

 

and now when you access localphpmyadmin.com, it will open phpmyadmin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.