Source nginx combined with tomcat dynamic and static separation

Environmental preparation [One Centos6]

1. Turn off iptables and SELinux, and test yum is available

service iptables stop
   setenforce 0
   yum repolist

2. Install the library environment that nginx depends on

yum -y install gcc gcc-c++ pcre-devel zlib-devel

3. Unzip/compile/install nginx

tar xf nginx-1.12.2.tar.gz 
   cd nginx-1.12.2
    ./configure 
   make && make install

4. Install the JDK environment and configure the environment variables

rpm -ivh jdk-8u20-linux-x64.rpm 
     cat etcprofile-tomcat >>/etc/profile
     source /etc/profile
     java -version

Version 1.8 explains that the environment variable configuration is correct and the
Insert picture description here
additional content is as follows:
Insert picture description here

5. Install tomcat

tar xf apache-tomcat-7.0.47.tar.gz 
    mv apache-tomcat-7.0.47 /opt/tomcat

6. Configure to use Nginx reverse proxy to forward JSP requests to Tomcat

Edit configuration file

vim /usr/local/nginx/conf/nginx.conf

modify
Insert picture description here

Insert picture description here

7. Start Nignx and Tomcat

 /usr/local/nginx/sbin/nginx
  /opt/tomcat/bin/startup.sh 

Port verification
Insert picture description here

8. Visit to test dynamic and static separation effect

Insert picture description here
Copy root directory

cp /opt/tomcat/webapps/ROOT/* /usr/local/nginx/html/

Insert picture description here

Guess you like

Origin blog.csdn.net/qing1912/article/details/108745465