Results 1 to 3 of 3
  1. #1

    httpd.conf in a load balancing scenario

    Has anybody figured out a way to share the httpd.conf config file for 2 servers in a load balancing scenario. Basically, I am using LVS and keepalived all on Fedora Codre 3 servers to load balance web requests. Since I have several virtualhosts who are binded to specific IP addresses I (and also since my webservers are natted behind my LVS director) I need to map the same public address to 2 different private one. ie: each request for will end up to or inside my LAN. Now this prevents me from using one httpd.conf file for both webserver. Ideally I want to have both webservers with cifs mount points so that I can share 1 httpd.conf file (and also ssl certificates). This way there would only be one file to edit and less human error while doing modifications. Is there any way to use mod_rewrite or variables. Or can I do a trick by using includes. If anybody has attempted to do this please share the info.

  2. #2
    you have a few options here really

    1: You can use NFS and share the configuration directory to all the webservers.

    2: You can use rdist to sync the files across to the machines.

    I have a web cluster of 16 webservers running my site and I use rdist to keep configuration files and other files the same off of my master system. I use it also to keep my sites files in sync and other configuration files. The perl script will only let 1 instance of it be ran at a time and it is 4755 so any user on the system can run it. All you need to do is set ssh keys for root on all the webservers you need it to sync to. Bellow you will see the source to the perl script. I hope I have been able to help you out.


    use Getopt:td;


    if(-e "/tmp/sync-lock")

    $ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin";

    $< = 0;
    $> = 0;

    die "quick-sync already running\n"
    if(-e "/tmp/sync-lock");

    open(FILE, ">/tmp/sync-lock") ||
    die "unable to create lock file!\n";
    print FILE "lock";
    system("rdist", "-P", "/usr/bin/ssh", "-f", "/etc/distfile-sync");


    And the distfile-sync (plain text) file looks like:

    REMOTE_HOST = ( [email protected] [email protected] [email protected] [email protected]
    [email protected] [email protected]
    [email protected] [email protected] [email protected] [email protected] [email protected]
    [email protected] [email protected] [email protected] [email protected] [email protected]
    [email protected] )

    FILES = ( /etc/crontab /etc/resolv.conf /etc/security/limits.conf
    /etc/hosts /home/admin /home/rude
    /home/crimsonviper/www /home/visicom/ /etc/httpd/conf/httpd.conf
    /etc/httpd/conf/vhost/* /etc/sysconfig/network-scripts/ifcfg-lo*
    /var/www/html/* /home/robotrage/ /home/donotchangeme/
    /var/log/httpd/access* /var/log/httpd/error*)

    ${FILES} -> ${REMOTE_HOST}
    install -oremove,chknfs;
    except /home/admin/mancala/cgi-bin/mancala/pbem-data;

  3. #3
    Join Date
    Jan 2005
    Use sed and make a wrapper to edit your httpd.config. Basically,

    edit httpd.conf with dummy variables instead of IPs (like FUNGUS or something that will never come up in an apache config) then sed them into specific files. Do/alias something like this.

    vi httpd.conf.master ;sed -e "s/FUNGUS/IP for server1/g" httpd.conf.master > httpd.conf1 ; sed -e "s/FUNGUS/IP for server2/g" httpd.conf.master > httpd.conf2

    You can share the configs/content over NFS and if you have each apache run with it's specific httpd.conf, and never have to edit more than one config file.

    CROWHOST hosting+colocation services | 877-CROWHOST | support at
    Independent remote-hands serving all Chicago data centers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts