环境准备:
1、确定系统网络、yum源可用
2、确认关闭iptables规则
3、确认停用Selinux
安装
yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake
yum -y install wget httpd-tools
一次初始化
cd /opt
mkdir app download logs work backup
关闭iptables规则
iptables -L
iptables -t nat -L
iptables -t nat -F
yum 安装nginx
官网下载nginx: https://nginx.org/en/linux_packages.html#stable
vim /etc/yum.repod/nginx.repo
[nginx] name=nginx repo baseurl=https://nginx.org/packages/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1
#修改baseurl os:centos OSRELEASE:centos版本号
例如:Linux操作系统是centos6.x版本的,如下:
vim /etc/yum.repod/nginx.repo
[nginx] name=nginx repo baseurl=https://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1
:wq 保存退出
yum install -y nginx
查看nginx的版本
nginx -v
查看安装nginx编译参数:
nginx -V