1、把nginx安装包及其需要的环境依赖包gcc、gcc-gcc+、libtool、prce放入install-nginx文件夹
2、把文件夹上传到linux的root目录下。
3、cd root && chmod +x install-Nginx && ./install-Nginx 执行安装脚本
profile是环境变量文件,install-Nginx是安装脚本,在环境变量文件末尾加上nginx的安装路径:export PATH=$PATH:/usr/local/nginx/sbin。
install-Nginx安装脚本命令集合如下
cd /
mkdir -p /usr/local/nginx &&
mkdir -p /root/nginx-dependents &&
cd /root/install-nginx
cp -rf profile /etc/profile
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
cd /root/install-nginx/gcc
rpm -Uvh --force --nodeps *rpm