For a set of VPSes operated by my company, I'd like to get a list of domain names hosted by each. The list of names has grown in an ad-hoc way for a few years. Is there a simple way to query the Apache and/or Nginx configurations to see what domains the server answers to on port 80?
It is safe to assume (a) that I have sudo on these systems, and (b) they aren't using wildcards, although a solution which acknowledged that a wildcard was in use would be useful too if it also provided a list of explicit domains.
I see two possible ways. First:
Second:
Here 1.2.3.4 is your server's external IP. Of course, this will do the trick if PTR records were maintained together with A records.
Or I missed something in your question?..
Will print out virtual hosts for apache, but I don't know how to get this in nginx.