How do I check from server side/using bash shell how many domains are hosted on the server?

The goal is to discover how many domains are hosted on the server that are exposed via http/https. (Can be connected to remotely)

The server is running drupal applications.

  • I thought I understood the question. Until I got to the last paragraph. Are you sure that what you mention in the last paragraph will do it? ( If it will is that not the answer? ). Please make it clear what you are trying to do. What you have tried. What worked (and why it is unsatisfactory). What did not work. Apr 18 '20 at 21:35
  • 1
    @ctrl-alt-delor removed the last paragraph.
    – drxl_3321
    Apr 18 '20 at 21:43
  • Have you looked it the configuration file of the web-server? Apr 18 '20 at 21:47
  • Which configuration file are you suggesting I look at and where can I find it/them?
    – drxl_3321
    Apr 18 '20 at 21:52
  • No Idea. Which web-server are you using? Apr 18 '20 at 21:57

Presumably your intention is a reverse-lookup of all network interfaces. Be aware that by reverse lookup you may trigger security alarms, since it looks like scanning available resources. Basically you'd enumerate all network devices, get their IPs and do a reverse lookup with the help of (outbound) DNS-services.

The first part is easy:

ip addr

This lists all network devices and their IP-addresses. With this you can use your favorite DNS-query tool to reverse-lookup, e.g. dig, nslookup, …

Your question for all domains is rather general and maybe you don't mean domain as in a URL's domain part. A server may expose multitudes of HTTP-based applications, assigned to them based on the Host-parameter of a HTTP-request. Also the server might be a virtual one.

To stay safe, check configuration files on the server only, maybe use find or grep to get them all. Apache Web Server and Nginx don't differ that much and often use a configuration named http.conf (importing many others). They're often found in /etc/apache or similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.