Ubuntu & NGINX Web Server - Multiple Subdomains to Log In To phpMyAdmin

Started by mahesh, Oct 12, 2023, 08:08 AM

Previous topic - Next topic

mahesh

I'm trying to have 2 separate subdomains from 2 different websites have access to logging into the same phpMyAdmin.
I'm not sure how to set up the phpmyadmin.conf file so that NGINX knows how to forward both subdomains to the phpmyadmin login page.
Here's what my Nginx Server Block for the phpmyadmin.conf file looks like, located at /etc/nginx/conf.d/phpmyadmin.conf
Code:
server {
listen 80;
listen [::]:80;
server_name pma.website1.com;
root /usr/share/phpmyadmin/;
index index.php index.html index.htm index.nginx-debian.html;

access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;

location / {
try_files $uri $uri/ /index.php;
 }

location ~ ^/(doc|sql|setup)/ {
deny all;
 }

location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
 }

location ~ /\.ht {
deny all;
 }
}
So, I'm
wondering how I can have both pma.website1.com subdomain and pma.website2.com subdomain both redirect to the main phpmyadmin log in page. Any support would be appreciated.