Apache vhosts problem -> solved
lipilee <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.user |
|---|---|
| Organization | lipilee.hu |
| Message-ID | <[email protected]> |
...or at least worked around.
I had to do smth about this issue as I changed
/opt/ispman/templates/vhosts.conf.template to have virtualhosts both for
port 80 and port 443. (practically speaking, I want to grant SSL enabled
vhosts by default to all my clients.)
problem is, that you have to physically stop and start apache when
dealing with SSL vhosts. shitty thing, we have to live with it.
the problem that some of us had was that when creating a brand new
vhost, ispman for some reason screws up the .conf and .hash files for
the new vhost including the previous domain created. this is a security
bug as there may be old and outdated information in the duplicated conf.
the problem can be found in /opt/ispman/lib/http.lib around and after
line 469. (at least in my 1.2 installation.) it says 'sub reloadApache'
there. this function is called by ispman-agent after creating a new
virtualhost and seemingly if it returns with a bad value ispman-agent
retries to create the vhost or smth resulting in a broken vhost conf and
hash file.
what I did was I replaced all the 'if' conditions with only one in sub
'reloadApache':
system( $ispman->getConf('apacheStopCommand') );
sleep $ispman->getConf('sleepSecondsBetweenRestart');
system( $ispman->getConf('apacheStartCommand') );
and I left the return value part intact:
my $rc = $?;
print "rc=" . $rc . "\n";
return $rc > 0 ? 0 : 1;
so now the whole 'sub apacheReload' function looks like this for me:
sub reloadApache {
system( $ispman->getConf('apacheStopCommand') );
sleep $ispman->getConf('sleepSecondsBetweenRestart');
system( $ispman->getConf('apacheStartCommand') );
my $rc = $?;
print "rc=" . $rc . "\n";
return $rc > 0 ? 0 : 1;
}
this works perfectly for me as I need to stop and start apache every
time anyway (because of SSL). I set the sleepSecondsBetweenRestart value
to 8 seconds, on my machine I experienced around 5-6 seconds until all
apache processes die after an apache stop. (this is a P4 box.)
this solved all the problems. now, if you don't want SSL, you obviously
don't want to restart Apache every time, apache reload in this case is
perfect for you. imho the 3 options (restart, reload, and graceful
restart) is not necessary so one of them fits your needs. just set
'apacheGracefulCommand' in the ispman web preferences (or, as I do,
directly in your LDAP directory) to something you like, e.g.
'/etc/init.d/apache reload' and set the others to something, whatever.
then, for you the 'sub reloadApache' should look like this:
sub reloadApache {
system( $ispman->getConf('apacheGracefulCommand') );
my $rc = $?;
print "rc=" . $rc . "\n";
return $rc > 0 ? 0 : 1;
}
bang, there you have it. no errors, no duplicate confs.
hope this helps, I've seen like 3-4 other people having the same problem.
cheers,
--
lipilee [email protected]
+36-30-280-1740 icq: 29533018
__________________________________________________________________
key fingerprint: 71C7 1CC5 ED1A DCF5 089D C78F 875A 5AD7 1E2C 2B5C
pgp public key: http://lipilee.hu/about/pubkey-lipilee.gpg
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click