安装部署nginx+tomcat

    科技2022-07-10  104

    安装依赖包:

    # yum install gcc gcc-c++ openssl-devel pcre-devel zlib-devel

    上传源码包到root下:

    # nginx-1.12.2.tar.gz

    解压并进入nginx:

    # tar zxf nginx-1.12.2.tar.gz # cd nginx-1.12.2

    编译并安装:

    # ./configure && make && make install

    启动nginx:

    # /usr/local/nginx/sbin/nginx

    查看80端口是否启动成功:

    # netstat -lptnu | grep 80

    启动成功查看网页是否显示nginx: 上传源码包至root下:

    jdk-8u20-linux-x64.rpm

    解压安装并查看:

    # rpm -ivh jdk-8u20-linux-x64.rpm # vim /etc/profile    #修改配置文件 export JAVA_HOME=/usr/java/jdk1.8.0_20 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH # java -version     #查看 openjdk version "1.8.0_262" OpenJDK Runtime Environment (build 1.8.0_262-b10) OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)

    上传Tomcat源码包到/opt下:

    # apache-tomcat-8.0.30.tar.gz  

    解压安装:

    # tar -xf apache-tomcat-7.0.47.tar.gz # mv apache-tomcat-7.0.47 tomcat    #修改文件名为tomcat

    启动:

    # /opt/tomcat/bin/startup.sh  

    查看是否启动:

    # netstat -tnalp | grep :8080 tcp 0 0 :::8080 :::* LISTEN 1563/java

    网页测试: 修改nginx配置文件:

    # vim /usr/local/nginx/conf/nginx.conf location ~ \.jsp$ { proxy_pass http://127.0.0.1:8080; }  

    重启nginx

    Processed: 0.041, SQL: 8