How can I reliably find the location of httpd.conf?

I am looking for a solution, or if necessary a combination of things that will find the location of httpd.conf quickly and reliably on as many Operating Systems as possible.


  • 1
    find / -name "httpd.conf" ? or apache2 -V that gives something like SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"? – user2196728 Nov 18 '15 at 1:11
  • That's not bad, but could be very slow in a big filesystem. Perhaps there are very common places for httpd.conf that could limit where we look? Or perhaps httpd.conf location is always somewhere relative to some other apache thing? – mareoraft Nov 18 '15 at 1:16
  • I was hoping there was an apache2 command that just told you where it was. – mareoraft Nov 18 '15 at 1:18
  • I installed apache24 on FreeBSD via pkg, but both "apache2" and "apache24" are not commands. Now I'm trying to find that. – mareoraft Nov 18 '15 at 1:21
  • It looks like apachectl -V is working for me on both OSX and FreeBSD. – mareoraft Nov 18 '15 at 1:31

For me,

apachectl -V

works on both OSX and FreeBSD.

If anybody has a better answer or a continuation of this answer for other operating systems, feel free to share.

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.