tags:

views:

27

answers:

2

Hi all,

This has happened to me a few times and I'd like to save time in the future when running into this situation.

I often either help colleagues out with site deployments or web server configuration. Most times I find myself spending more than what I'd like figuring out:

  1. Which apache is running
  2. Which httpd.conf is being used
  3. Which vhosts file is being used (if any)
  4. Where documentroot is pointing to.

#3 and #4 I know I can figure out by looking at httpd.conf. No biggie there. But it's be great if anyone could share a bas command that can help me figure out #1 and #2.

Thanks!

Luis

+1  A: 

1:

-sh-3.00$ ps auxww|egrep "(http|apache)"
root      8074  0.0  0.3 14236 6696 ?        Ss   Feb11   0:01 /usr/sbin/httpd
...
-sh-3.00$ rpm -qf /usr/sbin/httpd
httpd-2.0.52-25.ent
-sh-3.00$ 

2:

not too sure about the question... if you cannot see conf in the ps output then it'll be the default /etc/httpd/conf/httpd.conf

Bear in mind that it may include other files, but you can check that by looking at the contents of it and checking for include statements.

pulegium
Awesome, thanks for this!
luisgo
A: 

apachectl -v shows the version of apache your are running. as for "which httpd.conf its running", can you elaborate? do you mean you have multiple httpd.conf ? httpd.conf usually is located in /etc, so you can just do a find on /etc eg

$ find /etc/ -type f -iname "httpd.conf"
ghostdog74
Ah... perfect.That tells me which httpd.conf file apache is using. I ask because there may be more than one installation and some times it's not easy to figure out which one is actually serving pages. So doing a simple find on httpd.conf may return more than one file.Now, say there's two installations... how do I figure out whoch one is serving sites? Will a `which apachectl` do?
luisgo