参考文档:openresty.org/cn/installa…
OpenResty的安装过程比较简单,官方文档也已经讲得很详细了,这里主要是做一下安装记录
1、安装
# 下载
wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
# 安装依赖库
yum install pcre-devel openssl-devel gcc curl
# 解压
tar -zxvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2/
# 配置(检测环境、生成Makefile、为编译做准备)
./configure
# 编译
make
# 安装
make install
主要注意两点:
-
安装前需要准备依赖库
-
./configure
默认 --prefix=/usr/local/openresty,程序会被安装到/usr/local/openresty目录
可以自己指定各种选项,比如
./configure --prefix=/opt/openresty \ --with-luajit \ --without-http_redis2_module \ --with-http_iconv_module \ --with-http_postgres_module
使用
./configure --help
查看更多的选项./configure运行出错可以到
build/nginx-1.13.6.2/objs/autoconf.err
查看
2、启动
配置环境变量
shell> vim /etc/profile
添加一行
export PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH
shell> source /etc/profile
启动
shell> nginx -c /usr/local/openresty/nginx/conf/nginx.conf
重新加载配置
shell> nginx -s reload