Nginx: How to list virtual hosts
Unlike Apache (see https://forum.ivorde.com/apache-how-to-list-virtual-hosts-that-are-currently-configured-on-my-apache-server-t53.html
), nginx does not have, at the time of this writing, a builtin option to list configured virtual hosts, so in order to lists vhosts in Nginx web server, all nginx configuration files should be checked for the key "server_name" that are not commented (lines begin with #).
How to list virtual hosts configured in NGINX
root@ubuntu-vpsie:~# find /etc/nginx/ -type f -name "*.conf" -print0 | xargs -0 egrep '^(\s|\t)*server_name'
/etc/nginx/conf.d/server1.conf: server_name server1.domain.com;
/etc/nginx/conf.d/server2.conf: server_name server2.domain.com;
is nginx configuration directory and "*.conf" are all configuration files.