1.添加源

# add the yum repo:
wget https://openresty.org/package/centos/openresty.repo
mv openresty.repo /etc/yum.repos.d/

# update the yum index:
yum check-update

2.安装

yum install -y openresty