Ubuntu 安装配置 JDK+Tomcat+Nginx

安装配置JDK

下载安装
# 下载: 
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz"

# 解压
tar -zxvf jdk-8u191-linux-x64.tar.gz

sudo mkdir -pv /usr/java
cp -r jdk1.8.0_191/ /usr/java

# 配置环境变量
vi /etc/profile

--------------------- 
export JAVA_HOME=/usr/java/jdk1.8.0_111
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH  
--------------------- 
判断配置是否生效
source /etc/profile  # 配置立即生效

root@yuubuntutest:~# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

安装配置Tomcat

# 下载
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz

# 解压
tar xvzf apache-tomcat-8.5.35.tar.gz

# 管理
cd apache-tomcat-8.5.35/

sh bin/startup.sh # 打开tomcat

# 开启后可使用服务器IP:8080 端口访问Tomcat首页

sh bin/shutdown.sh # 关闭tomcat

安装及配置Nginx

# 安装
sudo apt-get install nginx

# 启动Nginx
sudo /etc/init.d/nginx start

# 关闭Nginx
sudo /etc/init.d/nginx stop

Nginx配置Tomcat代理

 server {
        listen       80;
        server_name localhost;

        location / {
                proxy_pass http://127.0.0.1:8080;
                }
        }
} # 和http 元素在一个}内

posted @ 2018-11-22 15:09  taro_秋刀鱼  阅读(614)  评论(0编辑  收藏  举报