源码安装 openresty

#!/bin/bash

# 参考文档:https://openresty.org/en/installation.html

# 定义版本号
OPENRESTY_VERSION=1.21.4.1

# 安装编译依赖
yum install pcre-devel openssl-devel gcc curl -y

# 下载 openresty 源码
curl -OL https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz

# 编译安装
tar -xvf openresty-${OPENRESTY_VERSION}.tar.gz
cd openresty-${OPENRESTY_VERSION}/
./configure -j2
make -j2
sudo make install

# 配置环境变量
echo 'export PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH' >> ~/.bashrc
source ~/.bashrc

# 启动 openresty,nginx 所在目录 /usr/local/openresty/nginx
nginx

 

posted @ 2023-04-20 10:49  Nihaorz  阅读(53)  评论(0)    收藏  举报