nginx+tomcat结构设计 1 安装及配置nginx a.下载nginx:http://nginx.org/download/nginx-1.12.0.tar.gz b.安装:
>tar -xzf nginx-1.11.12.tar.gz >cd nginx-1.11.12 >useradd -s /sbin/nologin -M nginx >./configure --prefix=/usr/local/nginx --useer=nginx --group=nginx --conf-path=/etc/nginx.d --sbin-path=/usr/local/bin --with-http_ssl_module --with-http_stub_status_module >make && make installc.配置nginx.conf
vim /etc/nginx.d/nginx.conf location ~ \.jsp${ proxy_pass http://192.168.100.32; }2 安装及配置tomcat a.安装详细请查看这里写链接内容
3 配置环境 a.配置nginx主机IP
>ifconfig eth0 172.16.113.157 up >ifconfig eth1 192.168.100.32 up b.配置tomcat主机IP >ifconfig eth0 192.168.100.34 c.关闭iptables >service iptables stop4 测试 curl http://172.168.113.157
nginx+tomcat+tomcat体系机构设计
1.配置nginx.conf
http{ upstream tomcat{ server 192.168.100.23:8080; server 192.168.100.14:8080; } server{ location / { proxy_pass http://tomcat; } } }2.配置tomcatA环境及测试页面
>ifconfig eth0 192.168.100.23 up >service iptables stop >vim /usr/local/tomcat/webapps/text/index.jsp <html> <head> <title>tomcatA</title> </head> <body> <h1>tomcatA is runing!!!</h1> </body> </html>3.配置tomcatB环境及测试页面
>ifconfig eth0 192.168.100.14 up >service iptables stop >vim /usr/local/tomcat/webapps/text/index.jsp <html> <head> <title>tomcatB</title> </head> <body> <h1>tomcatB is runing!!!</h1> </body> </html>4.测试