环境
- 操作系统:Centos7.9
下载安装包
下载地址:OpenResty - 下载
我下载的版本是 openresty-1.21.4.1.tar.gz
解压
tar zxvf openresty-1.21.4.1.tar.gz
configure
# 切到解压后的openresty文件夹
cd openresty-1.21.4.1
# configure, --prefix指定安装的路径
./configure --prefix=/usr/local/openresty
编译
make
安装
make install
启动nginx服务
# 测试nginx配置文件是否正确
/usr/local/openresty/nginx/sbin/nginx -t
# 启动nginx服务
/usr/local/openresty/nginx/sbin/nginx
访问 http://localhost:80
正常显示openresty欢迎页面,说明安装成功
我安装中遇到的错误
./configure: error: SSL modules require the OpenSSL library.
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...
解决
sudo yum install openssl-devel
参考
OpenResty - 下载