1、添加官方源
$ sudo yum install yum-utils
$ sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
2、安装依赖
$ yum install pcre-devel openssl-devel gcc curl
3、官网下载解压安装包
$ tar -zxvf openresty-1.13.6.2.tar.gz
然后在进入 openresty-VERSION/ 目录, 然后输入以下命令配置:
./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 查看更多的选项。
安装其他模块需要单独安装依赖
例如安装http_postgres_module 需要自行安装pgsql运行依赖
lua模块 是默认包含的,我们直接默认安装
./configure --prefix=/opt/openresty \ --with-luajit

配置成功后成了了 make file 就可以make && make install
电脑多核的话 可以加上参数-j 多线程编译
make -j2 && \
make install
安装完成后 去目录下nginx 即可
/usr/local/openresty/nginx/sbin/nginx -c xxx.conf
网友评论