Link to home
Start Free TrialLog in
Avatar of FikreDeneke
FikreDenekeFlag for United States of America

asked on

Confirm Apache (2.x?) on Windows the Apache config file and access file names and location. If the ELB would show it's IP in the log file vs. client

1. Where or what is the default Apache (2.x?) config file for Windows as I see more than one? I see three httpd*.conf (each with a date in the filename, possible backup) and one called httpd.conf (most recent time stamp). They were in the folder
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf

2. I'm looking for the access.log file(s) showing inbound requests which I believe I found with all the other files such as apache_reverse*.log, SSLaccess.log.* and so forth, but the access.log files are 0 byte. It might be a permissions issue, but is it called access*.log? All the files mentioned were found in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\cache-proxy\logs.

3. If you are using an ELB (AWS) wouldn't it mask/substitute the client's IP with it's own? I say this b/c the SSLaccess.log files "seem" to be showing the IPs of ELB and wasn't sure if the access.log, if it contained any data would be any different. Both log settings are using the parameter %h to capture client's IP.


httpd.conf file contents:

CustomLog "logs/access.log" combined
LogLevel debug

ErrorLog "C:\Program Files (x86)\Apache Software Foundation\apache2.2\cache-proxy/logs/apache_error.log"

CustomLog "C:\Program Files (x86)\Apache Software Foundation\apache2.2\cache-proxy/logs/apache_reverse_%m%d%y.log" custom

Thank you
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

There is no one specific location for the httpd.conf file. It completely depends on which one is being used by the Apache process itself.

So to figure out the right one, first you have to figure out which .exe file is being run. Go into your Task Manager and add columns so you can see the "Image path name" and/or the "Command line" column. Then find the Apache process (usually httpd.exe) and look at those columns. You should see the full path to the binary, like:

C:\Program Files (x86)\Apache Software Foundation\apache2.2\bin\httpd.exe

In some cases, you MIGHT also see the config file specified (in the "Command line" column), but that is a less-common situation in Windows. So normally, once you know the folder that the httpd.exe is running from, just swap out the "\bin\httpd.exe" at the end of the path for "\conf\httpd.conf", so:

Process:
C:\Program Files (x86)\Apache Software Foundation\apache2.2\bin\httpd.exe

Config file:
C:\Program Files (x86)\Apache Software Foundation\apache2.2\conf\httpd.conf

As far as the zero-byte log files go, it's definitely possible that it's a permissions issue. Normally you don't write data into any of the Program Files folders - they are set up with permissions so the installer can put the application files in there, but then it's locked down.

Try updating the config to use some other folder that you've created for its logs. For example, go create C:\ApacheLogs and use that for the folder for your logs.

Also remember that there are logs in the main config area but you can also have site-specific logs in your VIrtualHost entries.

As far as the IPs go on the Elastic Load Balancer, there should be a header "X-Forwarded-For" that contains the chain of public IPs, so update your combined log format to look like this:

LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.