Create folder
mkdir /usr/local/nginx
Download Nginx and unzip
//版本号可以根据官网的最新稳定版自行调整
wget -c https://nginx.org/download/nginx-1.19.0.tar.gz
installation
#根目录使用ls命令可以看到下载的nginx压缩包,然后解压
tar -zxvf nginx-1.19.0.tar.gz
#解压后进入目录
cd nginx-1.19.0
#使用默认配置
./configure
#编译安装
make
make install
#查找安装路径,默认都是这个路径
[root@VM_0_12_centos ~]# whereis nginx
nginx: /usr/local/nginx
#启动、停止nginx
cd /usr/local/nginx/sbin/
./nginx #启动
./nginx -s stop #停止,直接查找nginx进程id再使用kill命令强制杀掉进程
./nginx -s quit #退出停止,等待nginx进程处理完任务再进行停止
./nginx -s reload #重新加载配置文件,修改nginx.conf后使用该命令,新配置即可生效
#重启nginx,建议先停止,再启动
./nginx -s stop
./nginx
#查看nginx进程,如下返回,即为成功
[root@VM_0_12_centos ~]# ps aux|grep nginx
root 951 0.0 0.0 46456 972 ? Ss 00:12 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 957 0.0 0.0 46848 1928 ? S 00:12 0:00 nginx: worker process
root 7189 0.0 0.0 112708 988 pts/0 S+ 11:34 0:00 grep --color=auto nginx
Create folder
mkdir /usr/local/java
Download jdk8, unzip
wget http://javadl.oracle.com/webapps/download/AutoDL?BundleId=220305_d54c1d3a095b4ff2b6607d096fa80163
tar -zxvf AutoDL?BundleId=220305_d54c1d3a095b4ff2b6607d096fa80163
Rename
mv AutoDL?BundleId=220305_d54c1d3a095b4ff2b6607d096fa80163 jdk1.8
Configuration Environment
vi /etc/profile
添加:
JAVA_HOME=/usr/java/jdk1.8.0_131
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
source /etc/profile
Verify that the installation is successful: java -version
[root@iZ0m776tp7k6weZ bin]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Create folder
mkdir /usr/tomcat
Download Tomcat8, unzip
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.56/bin/apache-tomcat-8.5.56.tar.gz
tar -zxvf apache-tomcat-8.5.56.tar.gz
Start service
cd /usr/tomcat/apache-tomcat-8.5.56/bin
./startup.sh
Whether the visit is installed successfully
curl localhost:8080
Then open the firewall, open the two ports 80 and 8080, and close the firewall.
systemctl status firewalld
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
systemctl stop firewalld.service
systemctl disable firewalld.service