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