linux centos7下安装jdk1.8和nginx

安装jdk1.8

mkdir /usr/local/java
cd /usr/local/java
#解压
tar -zxvf jdk-8u211-linux-x64.tar.gz
#删除安装包
rm jdk-8u211-linux-x64.tar.gz

vi /etc/profile

#环境变量配置

##java env
export JAVA_HOME=/usr/local/java/jdk1.8.0_211
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/rt.jar

#使配置立即生效
source /etc/profile
#查看安装是否成功
java -version

nginx安装

1.安装nginx
#添加Nginx到YUM源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
#安装Nginx
yum install -y nginx
#启动Nginx
systemctl start nginx.service

2.设置开机启动

systemctl enable nginx.service

3.如果有防火墙,开放80端口
#添加开放端口
firewall-cmd --permanent --zone=public --add-port=80/tcp
##重载配置
firewall-cmd --reload
3.nginx常用操作
#启动
systemctl start nginx.service
#停止
systemctl stop nginx.service
#重启
systemctl restart nginx.service
#重载配置
systemctl reload nginx.service
#加入开机启动
systemctl enable nginx.service
#查看启动后记录
ps aux | grep nginx
#查看端口号
netstat -tlnp
4.nginx配置信息
#网站文件存放默认目录
/usr/share/nginx/html

#网站默认站点配置
/etc/nginx/conf.d/default.conf

#自定义Nginx站点配置文件存放目录
/etc/nginx/conf.d/

#Nginx全局配置
/etc/nginx/nginx.conf
posted @ 2021-01-15 14:42  dkn  阅读(275)  评论(0编辑  收藏  举报