A total of two servers on a single server how to achieve high availability two tomcat

## nginx configuration file
Direct vim Picture Description

  1. vim editor directly open nginx.conf
  2. Modify nginx.conf
    increase
    upstream haha {
    Server 192.168.254.181:8080;
    Server 192.168.254.182:8080;
    }

location /项目名 {
root html;
index index.html index.htm;
proxy_pass http://haha/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 200M;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}

Modify nginx.conf
increase
upstream Hehe {
Server 192.168.254.181:8081;
Server 192.168.254.182:8081;
}

location / project name {
root HTML;
index index.html index.htm;
proxy_pass HTTP: // hehe /;
proxy_redirect OFF;
proxy_set_header $ Host Host;
proxy_set_header the X-Real-IP-$ REMOTE_ADDR;
proxy_set_header the X-Forwarded-the For-$ proxy_add_x_forwarded_for;
200M client_max_body_size;
client_body_buffer_size 128K;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4K;
proxy_buffers. 4 32K;
proxy_busy_buffers_size 64K;
proxy_temp_file_write_size 64K;
}
3. directly coupled with the two lines in the configuration file, the name of the specific project name as well as the actual schedule to;
4. port number of the port number is changed by pressing tomcat corresponding to the item which can not be wrong;
5.tomcat modify the port number shown below;
6. The Here Insert Picture Description
7. The editor Vim directly open the server.xml;
8. The Here Insert Picture Description
9. The Here Insert Picture Description
10. The Here Insert Picture Description
10. The three port numbers easily changed, there is no specific firewall see the port is not open then open Ports ;
11. firewall settings
12. start: systemctl start firewalld
Close: systemctl stop firewalld
Check status: System
CTL firewalld status
power disabled: systemctl disable firewalld
power enable: enable firewalld systemctl
13. See all open ports: firewall-cmd - ZON
E = the ports public --list-
update firewall rules: firewall-cmd --reload

add
firewall-cmd --zone = public --add- port = 80 / tcp --permanent (- permanent permanent, this parameter is not after the restart failure)
reload
firewall-cmd --reload
view
firewall-cmd --zone = public --query- port = 80 / tcp
Delete
Firewall---zone cmd = = public --remove-Port 80 / tcp --permanent

14. The completion of these services start chanting;
nginx start the service
cd / usr / local / nginx / sbin / execution
./nginx
Viewpoint whether there is an error error Follow the prompts to modify
tomcat start the service
cd / usr / local / tomat / bin execute
./startup.sh
are successful then the work on it;
want to help

Guess you like

Origin blog.csdn.net/weixin_42691754/article/details/83009522