multiple hosts and multiple ports in apache 1.1.1

multiple hosts and multiple ports in apache 1.1.1

Post by Phil Howa » Wed, 04 Sep 1996 04:00:00



Under both Solaris 2.4 and Linux (tried 2.0.12, 2.0.13, 2.0.14 and now on
2.0.17) Apache 1.1.1, when configured with several virtual hosts (IP based)
it seems to fail to associate the incoming connection with the right config
data sometimes.  It reports the objects missing and logs in the wrong file
(I have each virtual host going to its own log file) so it looks a lot like
the destination IP address and/or the port number is being picked up wrong.

In the Solaris case, I have the main server address and 4 additional addresses
each listening on ports 80 and 280.  The additional addresses are all setup
to redirect to another server elsewhere (specific subdirectories for each).
The main server works OK on port 80 and not at all on port 280.  But the
redirected ones work fine on both 80 and 280.  I juggled the configuration
for a test and made different host/port combinations do different things
and it's always port 280 on the main IP address not recognized.

In the Linux case, I have the main server using ports 80, 280, and 1080,
as well as 2 additional hosts only doing port 80.  This one is more weird
because sometimes port 80 on the main address works and sometimes not.
The other addresses work.

Mail me if you want to see the config file(s).  I have everything put in
a single httpd.conf file instead of three files, for easier managing.  I
hope that isn't the cause of the problem.

--
Phil Howard KA9WGN             +---------------------------------------------+
Unix/Internet/System Admin     |  When freedom is outlawed....               |
CLR/Fast-Tax                   |          ....only outlaws will be free!     |

 
 
 

1. Solution: multiple Apache log files, multiple args to env=, multiple conditions to CustomLog directive

Here is a solution to a problem I had a little while ago.  I wanted to
have Apache keep 3 separate log files: 1 for requests from me, a 2nd
for nimda virus attacks, and a 3rd for everything else.

The key to the solution was to use "!" to unset environment variables
in certain cases.  Joshua Slive pointed this out for me.

I'm posting this here because I can't find a way to use Google to
reply to those old posts of mine.

Here's an example that will log requests from a specific IP address
(presumably the webmaster's) to one file, and log nimda virus attacks
to another file.  A third log file will hold all the remaining
requests.

#========================================================================#
SetEnvIf Remote_Addr "w\.x\.y\.z" localaccess=1
SetEnvIf localaccess 1 dontlog

# Here, !localaccess will keep nimda requests out of the localaccess
log.
SetEnvIf Request_URI "^/scripts" nimda=1 !localaccess
SetEnvIf Request_URI "^/c/winnt" nimda=1 !localaccess
SetEnvIf Request_URI "^/_mem_bin" nimda=1 !localaccess
SetEnvIf Request_URI "^/_vti_bin" nimda=1 !localaccess
SetEnvIf Request_URI "^/MSADC" nimda=1 !localaccess
SetEnvIf Request_URI "^/msadc" nimda=1 !localaccess
SetEnvIf Request_URI "^/d/winnt" nimda=1 !localaccess
SetEnvIf nimda 1 dontlog

CustomLog logs/localaccess.log combined env=localaccess
CustomLog logs/nimda.log combined env=nimda
CustomLog logs/everythingelse.log combined env=!dontlog
#========================================================================#

I've received a couple emails about this problem, so I figure this
will help someone out.

-Anthony
www.nodivisions.com

2. KDE Start-up

3. multiple apache httpds with multiple VirtualHosts on port 80?

4. Multi-Processor Development for Linux (PCI bus)

5. Multiple hosts, multiple serve

6. Drop reliance on file->f_dentry in NFS reads/writes

7. scp of multiple files to multiple locations on remote host

8. Beta-testers for a new FidoNet mailer wanted

9. Multiple Hosts on Multiple NICS...Virtual Machines?

10. Multiple hosts, multiple servers

11. Reverse proxy to multiple origin servers on multiple ports

12. Apache, multiple log files, multiple args to " env= "

13. Apache -> ? multiple domains / multiple access_logs ?