#!/bin/sh
set -x
#serverlist=`ls -l /usr/local/nginx/conf/vhost/*.conf | awk -F" " '{print $9}'`
serverlist=`ls -l /usr/local/nginx/conf/vhost/*.conf | awk 'NR>2{print $NF}'`
for i in $serverlist;do
cat $i | grep -A10 "listen 443" | grep -v "listen 443" | awk -F"server_name" '{print $2}' | grep -v ^$ >> server.txt
done
sort -n server.txt |uniq
grep -ir "server_name" /usr/local/nginx/conf/nginx.conf | awk -F"server_name" '{print $2}'