1.安装 编译 openresty

http://openresty.org/cn/download.html
下载最新版的 openresty。
tar 解压。

  1. ./configure --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module --with-http_postgres_module

./configure 可能存在的报错信息。

./configure: error: ngx_postgres addon was unable to detect version of the libpq library.
ERROR: failed to run command: sh ./configure —prefix=/usr/local/openresty/nginx ...
nginx 升级到 openresty - 图1
解决办法。:
安装:postgresql-devel
yum install postgresql-devel

make

make install

2.配置

将原先的nginx.conf 配置
/usr/local/nginx/conf/ .conf —-》 /usr/local/openresty/nginx/conf/
/usr/local/nginx/conf/conf.d/
.conf —-》/usr/local/openresty/nginx/conf/conf.d/
修改还款变量。

vim /etc/profile
将原先 nginx 的 sbin 目录改为 openresty/nginx/sbin
source /etc/profile。

nginx -V
查看 安装信息。

重启服务,即可切换完成。