Allow PHPMyAdmin access on certain virtual hosts - Ubuntu and Nginx

mrast nginx-forum at forum.nginx.org
Fri Oct 7 14:20:51 UTC 2016


Hello Francis,

Thankyou for your reply.

I have seperate config files for each website in /etc/nginx/sites-enabled
and have removed the default file

I have this directive in /etc/nginx/nginx.conf

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

server {
listen 80 default_server;
server_name _;
return 444;
}

This is the start of my server block for website2 that i do want phpmyadmin
access for

server {
	server_name website.com www.website.com;

and the only phpmyadmin directive is for a pre-auth login box before the
phpam login page displays

	location /phpmyadmin {
		auth_basic "Admin Login";
		auth_basic_user_file /etc/nginx/allow_phpmyadmin;
	}

If i remove the /phpmyadmin section from website1 config file, it just
removes the pre-auth login box and goes straight to the main phpma screen.

I have a symlink for nginx to use phpmyadmin /usr/share/phpmyadmin
/usr/share/nginx/html

I have a symlink in website2 and 4 directory's for /usr/share/phpmyadmin

i dont have any symlinks in websites 1 and 3 directory's for
/usr/share/phpmyadmin - but yet these websites are still server /phpmyadmin

Im not sure what i need to remove after reading your reply - Shall i remove
the server_name line from the nginx.conf file?

Thankyou

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,270105,270117#msg-270117



More information about the nginx mailing list