less than 1 minute read

pre-requisite:

  1. at least 2 linux nodes installed with Tengine, instruction

I will use 2 linux nodes in this doc

  1. linux node1, ip: 192.168.157.11
  2. linux node2, ip: 192.168.157.12

Steps

in this doc I will use Tomcat to serve page

  1. download tomcat tar, I use Tomcat-8 in this doc, link
  2. upload the tar file into all linux nodes
  3. in each nodes, execute following commands
    1. tar -zxvf apache.xx.tar.gz -C /usr/local
    2. cd /usr/local/{your apache folder}/webapps/ROOT
    3. vi index.jsp do some change so that we can distinguish different nodes
    4. cd ../../bin
    5. ./catlina.sh run
    6. open browser, open {ip}:8080 to make sure tomcat is running
  4. in main linux node, in my case, node01
    1. vi /usr/local/tengine/conf/nginx.conf
    2. before server keyword, add following
      1. upstream tomcats {
                     server 192.168.157.11:8080;
                     server 192.168.157.12:8080;
                 }
        
    3. in server keyword, replace block of location / to
      1. location / {
                    proxy_pass http://tomcats;
                }
        
        
    4. run service nginx reload
    5. in browser, open 192.168.157.11, refresh the page, should see the page from different nodes.
  5. the final nginx.conf for reference.

FAQ

  1. how to check the error message of Tengine
    1. tail -f /usr/local/tengine/logs/error.log