Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 '13 at 9:59

3 Answers 3

up vote 7 down vote accepted

Configure and enable restricted access to mod_info

share|improve this answer

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)
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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