文章目录

一、软件安装验证


3. 服务器部署

系统版本

ip

部署应用

应用版本

centos7.7

192.168.159.101

nginx

1.9.9

centos7.7

192.168.159.102

tomcat

10

centos7.7

192.168.159.103

tomcat

10

centos7.7

192.168.159.104

tomcat

10

二、软件安装验证

2.1. 启动tomcat

Nginx 反向代理_软件安装

2.2. nginx配置
worker_processes  1;
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream tomcat-cluster {
server 192.168.159.102:8080;
server 192.168.159.103:8080;
server 192.168.159.104:8080;
}
server {
listen 80;
server_name 192.168.159.101;

location / {
proxy_pass http://tomcat-cluster;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
2.3. 关键配置
{
server 192.168.159.102:8080;
server 192.168.159.103:8080;
server 192.168.159.104:8080;
}
server {
listen 80;
server_name 192.168.159.101;

location / {
proxy_pass http://tomcat-cluster;
}
2.4. 启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
2.5. 测试验证

Nginx 反向代理_反向代理_02