Apache guru required (2.0.58)

Small outline of the problem, one host, mamy modules and some location directives. The behaviour I’m seeing is a bit strange - in any location, in fact in it just seems to go through the first one in the list, so regardless of location in this example I always get the libhandle_image.so results, which of is the first loaded, I’ve tried numerous orders of the LoadModule and the behaviour is the same, it runs the first one loaded… :confused:

<VirtualHost x:80>
       LoadModule  Image                   /usr/lib/apache2/modules/libhandle_image.so
       LoadModule  PW_Submit               /usr/lib/apache2/modules/libhandle_pw_submit.so
       LoadModule  SampleImage             /usr/lib/apache2/modules/libhandle_sample_image.so

        <Location /pword>
                SetHandler PW_Submit
        </Location>
        <Location /Image>
                ForceType image
                SetHandler Image
        </Location>
        <Location /SampleImage>
                ForceType image
                SetHandler SampleImage
        </Location>

</VirtualHost>

It’s a Friday afternoon and I’m missing something - :help: :help:

DT.

:whiteflag: :smash:

an update - and this is most weird - another vhost in the conf file, so for sake of setup, vhost1 and vhost2

Both hosts have location directives.

If I go to the vhost1/location - the actual .so being callled is in the other flipping vhost !!!

<vhost1>
LoadModule mod1 module1.so
<Location /location1>
SetHandler mod1
</Location>
</vhost>

<vhost2>
LoadModule mod2 module2.so
<Location /location2>
SetHandler mod2
</Location>
</vhost>

So if that, how on earth does <ipaddyvhost2>/location2 invoke the loadedmodule from vhost1 ? Whatever we do with locations, the first module loaded in the entire file is the one being called? :help:

/edit - I know <Location> is working as <Location /goaway>Deny from all</Location> gives me a permission denied :boggle:

DT.

2 thoughts… as I’m only an apache “admin” not a “guru” :wink:

have you definately enabled NameBasedVirtualHosts?
is it possible (assuming unix based) to create virtual nic’s and run each site on it’s own ip ? not sure this one will help but it might help faultfind.

I’m assuming in the browser you’re calling the vhost by the url and not by the ip as the vhost entry is matched based on requested url (www.site1.com) as all vhosts share the same addy in this setup.

/Sorry if I’m teaching you to suck eggs :wink:

sorry not quite enough info, yes you can assume that the named based hosts and ip address are all correct :frowning:

Three ip’s on the one card, two listened to by apache and setup - was all working fine when we had compiled the modules to work with another module, modcplusplus. We then recompiled one .so with some extra hooks for apache and it worked, thinking yay, we did the rest. Without realising this error. I think we may need to go back to the apache modules book as I simply cannot find anything that would suggest this behaviour anywhere. The weird thing is ALL the modules will work, just only one at a time and they ALWAYS work regardless of the location :frowning:

DT.

OK - the solution … :slight_smile:

Apache takes an input and goes through the conf files, what it actually does with a location directive is go through EVERY compiled and referenced module to see if it is the right one, practice being that if the module name doesn’t match the module should return a DECLINED. We missed this three lines of if statement in our compiled modules, so it went to that module, didn’t get DECLINED and hence carries on.

So basically, apache puts all requests through the modules compiled to see if it needs to do anything. Three lines of code and we are sorted. RTFM :wink: :slight_smile:

DT.