Last active
December 16, 2020 13:15
-
-
Save rempargo/25e27c9805ec61e633956c584d090f87 to your computer and use it in GitHub Desktop.
Get all domain names from Nginx as a ruby array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ruby | |
# "server_name " include the whitespace to exclude non relevant results | |
# removes those server names that are commented | |
`sudo nginx -T | grep "server_name "`.gsub("server_name ","").delete("\t\n ").split(";").select{|domain|domain[0]!="#"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment