寻找开启https的nginx配置

2021-05-17 15:25:50 浏览数 (1)

#!/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}'

0 人点赞