nginx+tomcat
-
- Environmental preparation [One Centos6]
- 1. Turn off iptables and SELinux, and test yum is available
- 2. Install the library environment that nginx depends on
- 3. Unzip/compile/install nginx
- 4. Install the JDK environment and configure the environment variables
- 5. Install tomcat
- 6. Configure to use Nginx reverse proxy to forward JSP requests to Tomcat
- 7. Start Nignx and Tomcat
- 8. Visit to test dynamic and static separation effect
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
additional content is as follows:
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
7. Start Nignx and Tomcat
/usr/local/nginx/sbin/nginx
/opt/tomcat/bin/startup.sh
Port verification
8. Visit to test dynamic and static separation effect
Copy root directory
cp /opt/tomcat/webapps/ROOT/* /usr/local/nginx/html/