I'm working on a server someone else set up. The server is CentOS 4.6 running Apache/2.0.59 (httpd). They have an update service setup on port 8443. I know it is working but I need to find out what files Apache is serving when someone hits that port.
I looked in the httpd.conf file to see if there was anything in there but there was nothing there. I tried using nmap
too but that only showed me which ports are currently open. The output of nmap
was:
8443/tcp open https-alt
So how can I find out what files are served when someone connects to that port?
Best Answer
You can see where
httpd
is configured to look for it's configuration files using the-V
switch:You can also use the command
lsof
to see what files a Unix process is accessing. My version ofhttpd
is using the stock port 80 so change the 80 to 8443 in your case!You can now run
lsof
to find out where the log files are getting written to:You should be able to determine the location of the
access_log
as well as the configuration files and look through them to determine the "Directory" and "Location" directives. These specify what local directories to use when telling Apache what files to serve.Now what?
I would then look through the
access_log
to make sure that there are entries in there that correspond to accesses against the server. What I mean by this is if I browse the server athttp://www.somedom.com/somefile
I should see this access recorded in theaccess_log
file like this:Where are the files?
You can take the above knowledge that we've acquired and start to apply it like so:
These bits from
httpd -V
tells us Apache's root:So we know the main config file is here:
/etc/httpd/conf/httpd.conf
. So look through that file for these lines:So I now know that these directories are potential sources for the file we saw in the
access_log
. TheDocumentRoot
andDirectories
I'd look through for the file,somefile
. If it isn't in any of these locations then I'd next focus on theInclude
directory mentioned above in thegrep
output,/etc/httpd/conf.d/*.conf
.These files are additional configurations that Apache uses so you'd need to repeat the steps using the
grep
to look through these files as well.