Litespeed Server Config Variables

Discussion in 'Install/Configuration' started by Atticus, Nov 15, 2010.

  1. Atticus

    Atticus New Member

    I am setting up a load balanced Litespeed cluster and am sharing configs across all of the web servers to simplify maintain the configuration across the cluster.

    While trying to do this I have come across a need to find out what server variables are offered by Litespeed. I've checked the forums and docs and either missed it or it isn't answered.

    I know of $VH_ROOT and $SERVER_ROOT, but is there anything such as $HOSTNAME for the server hostname? Does anyone know of other variables, a reference, or how to add such a variable to Litespeed?

    Thanks,
    Atticus
  2. NiteWave

    NiteWave Administrator

    create a phpinfo() page, at the bottom, you can find all the server variables.
  3. Atticus

    Atticus New Member

    I'm talking about variables I can use inside httpd_config.xml, not some PHP script. Maybe I don't fully understand how Litespeed processes its config files, but I don't imagine PHP $_SERVER keys are going to be useful?
  4. NiteWave

    NiteWave Administrator

    looks like only 3 variable available: SERVER_ROOT, VH_ROOT, VH_NAME
    can you be more specific on how you load balance web servers.
    will forward your question to other staff.
  5. Atticus

    Atticus New Member

    The setup is fairly simple. One front-end load balancing application with three backend Litespeed web servers (and no, we're not using LSLB).

    I would like to share their httpd_config.xml between the three of them so that if I ever update the listeners, virtual hosts, etc, I don't need to go update all three servers one-by-one. It doesn't appear I can include files into the main config. If that were an option, I'd just move all of the non-unique config data to a shared file and go that route. But that isn't an option. The only real part of the config that cannot be shared across all three web servers is the server name. Everything else is fine.

    Being able to set <serverName>$HOSTNAME</serverName> would be incredibly beneficial.
  6. mistwang

    mistwang LiteSpeed Staff

    Next release, LSWS will use server's home name if you leave serverName blank.
  7. mistwang

    mistwang LiteSpeed Staff

    $HOSTNAME will works as well.
  8. Atticus

    Atticus New Member

    Awesome, awesome. That is good to hear.
  9. NiteWave

    NiteWave Administrator

    Now I'm clear about the request.

    although $HOSTNAME will be resolved, you may have other reasonable requirements in this case. for example, each backend server has different IPs, should the listeners' IP address change automatically? or you've to use 0.0.0.0 for any available IPs on that server.

    assume there are 100 backend web servers in a cluster, to deploy 100 different httpd_conf.xml, I think still need a simple script to do the necessary change on a template httpd_conf.xml and replace httpd_conf.xml on each host, and fire restart signal to lsws process in the script.
  10. mistwang

    mistwang LiteSpeed Staff

    $HOSTNAME will only work for <serverName> config, not anywhere else. :p
  11. Atticus

    Atticus New Member

    Actually, with being able to use $HOSTNAME in the config I can deploy -one- httpd_config.xml for the whole cluster. It along with individual virtual host configs are shared over NFS from a centralized pair of NFS servers.

    As for applying it to each, not a problem. I have a CLI script that I can add tasks to including resetting Litespeed on each backend web server.

    Litespeed has four listeners set up with various CPU mappings and virtual hosts listed under it. It is setup to, in a way, prioritize requests based on which listener it is routed to. Each listerner listens to 0.0.0.0:<port> where the port is between 8000 and 8004. Because we use this method, the config requires no further modifications other than the server name.

    Pretty simplistic. Makes cloning web servers a breeze.
  12. Atticus

    Atticus New Member

    Just a quick question, but when is the next release due out? If it's the same spacing between the previous two then it's sometime in February. So I am curious. Thanks!
  13. Atticus

    Atticus New Member

    Just a quick follow up, but was this feature ultimately not include in today's release or was it not noted on the change log?
  14. NiteWave

    NiteWave Administrator

    just not in the change log. Yes, now "Server Name" support $HOSTNAME, you may have noticed it.
    Last edited: Dec 9, 2010
  15. webizen

    webizen New Member

    Web admin console doesn't allow empty Server Name but you can (manually) leave it blank in httpd_conf.xml file. So the feature is there but not yet make to the change log (official).
  16. afdownload

    afdownload New Member

    how can i do that?
  17. webizen

    webizen New Member

    1. create a php file say phpinfo.php with this content:
    Code:
    <?php phpinfo(); ?>
    
    2. request the file via LiteSpeed web server http://your.server.com/phpinfo.php

    3. looking for section PHP Variables. you should see a bunch of variables like _SERVER["..."]
    Last edited: Dec 24, 2010

Share This Page