3

Is there any way to get list of Apache virtual hosts from outside of the server i.e. from another computer by querying the apache server.

1
  • That's internal state of the server and should not be accessible from outside. However you can write module that will export this information
    – gelraen
    Jan 18, 2013 at 9:59

3 Answers 3

7

Configure and enable restricted access to mod_info

1

Unless somebody implements a script on the server that does so and makes it accessible to you, certainly not - the HTTP protocol itself does not have such capability. Be aware that such a feature would be considered unwanted information disclosure by most admins if it was implemented and active by default. Basically, if you are an admin/developer involved in running the server, you can find out from the configuration; if you are not it is plain and simply none of your business.

1

From the command line you could use apachectl -S; the output is similar to the below.

$ apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443                  is a NameVirtualHost
         default server virtualhost1 (/etc/httpd/conf.d/virtualhost1:17)
         port 443 namevhost virtualhost1 (/etc/httpd/conf.d/virtualhost1:17)
         port 443 namevhost virtualhost2 (/etc/httpd/conf.d/virtualhost2:16)
*:80                   is a NameVirtualHost
         default server virtualdefault (/etc/httpd/conf/httpd.conf:144)
         port 80 namevhost virtualdefault (/etc/httpd/conf/httpd.conf:144)
         port 80 namevhost virtualhost2 (/etc/httpd/conf.d/virtualhost2:1)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .