I have a Ubuntu 18.04 server running a LEMP (Linux, Nginx, MySQL and PHP) stack secured with ufw. I installed phpMyAdmin by running these commands:
$ sudo apt update
$ sudo apt install phpmyadmin
During the installation process, I was prompted to choose the web server (either Apache or Lighthttp) to configure. I am using Nginx as web server, so I pressed tab and then OK to advance to the next step.
Then I was prompted whether to use dbconfig-common for configuring the application database, and I selected "Yes".
Once the installation was finished, I ran this command to create a symbolic link from the installation files to Nginx’s document root directory:
$ sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
My phpMyAdmin installation should now be operational. However, when I type mydomain.ca/phpmyadmin, it shows a 404 Not Found error. How can I fix this? Did I do something wrong?
server {
listen 80;
listen [::]:80;
server_name mydomain.ca;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mydomain.ca;
root /var/www/html/mydomain/public;
ssl_certificate /etc/letsencrypt/live/mydomain.ca/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.ca/privkey.pem;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES456-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES246-GCM-SHA384:DHE-RSA-AES456-GCM-SHA384:ECDHE-RSA-AES256-SHA394;
ssl_prefer_server_ciphers on;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php index.html index.htm index.nginx-debian.html;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ /.well-known {
allow all;
}
}