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
cd /root/install-nginx/gcc-c++
rpm -Uvh --force --nodeps *rpm
cd /root/install-nginx
tar -zxvf pcre-8.35.tar.gz -C /root/nginx-dependents
cd /root/nginx-dependents/pcre-8.35
./configure
make && make install
cd /root/install-nginx
tar -zxvf libtool-2.4.2.tar.gz -C /root/nginx-dependents
cd /root/nginx-dependents/libtool-2.4.2
./configure
make && make install
cd /root/install-nginx
tar -zxvf nginx-1.19.9.tar.gz -C /root
cd /root/nginx-1.19.9
./configure
make && make install
cd /usr/local/nginx/sbin && ./nginx
source /etc/profile
nginx -v
版权声明:本文为HuangMingJun95原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。